main.py 697 字节
Newer Older
6
643c11352e6b2c0eaeb061ac 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
num_list = {}

n_list = {}



index = 0

n = 0



for i in range(4, 10):

    for j in range(4, 10):

        for k in range(4, 10):

            for a in range(4, 10):

                if i != j and i != k and i != a and j != k and j != a and k != a:

                    num_list[index] = i * 1000 + j * 100 + k * 10 + a

                    index = index + 1



for m in num_list:

    x = num_list[m]

    for z in range(2, x):

        if x % z == 0:

            break

    else:

        n_list[n] = x

        n = n + 1



print("所有组合的数是 %s" % num_list)



print("共有 %d 个" % len(num_list))



print("所有质数是 %s" % n_list)



print("共有 %d 个" % len(n_list))