找出学霸的微信号

找出学霸的微信号

 

#-*- coding:utf-8 -*-
#Author:'Lmc'
#DATE: 2019/4/24/0024 上午 9:10:57
#FileName:微信号.PY

#厄拉多塞质数筛选法
def eladuosai(n):
    l = list(range(1, n + 1))
    l[0] = 0
    for i in range(2,n + 1):
        if l[i - 1] != 0:
            for j in range(i * 2, n + 1, i):
                l[j - 1] = 0
    result = [x for x in l if x != 0]
    return result

def run():
    x = int(input('请输入一个包含两个素数乘积为707829217的最大数:'))
    list_zs = eladuosai(x)
    for a in list_zs:
        for b in list_zs:
            if a * b == 707829217:
                if a > b:
                    wx = 'NY' + str(a) + str(b)
                    print('微信号为:',wx)
                break
run()

 

上一篇:laravel homestead vagrant box安装使用,问题,及相关命令


下一篇:Uva 12171 离散化加BFS