fork download
  1. def is_good(n):
  2. return pow(2, n, n) == 2 % n and pow(3, n, n) != 3 % n
  3.  
  4. result = []
  5. limit = 100000# đổi tùy ý
  6. for n in range(2, limit+1):
  7. if is_good(n):
  8. result.append(n)
  9.  
  10. print(result)
Success #stdin #stdout 0.07s 65088KB
stdin
Standard input is empty
stdout
[341, 645, 1387, 1905, 2047, 3277, 4033, 4369, 4371, 4681, 5461, 7957, 8321, 8481, 10261, 11305, 12801, 13741, 13747, 13981, 14491, 15709, 16705, 18705, 19951, 23001, 23377, 25761, 30121, 30889, 31417, 31609, 33153, 34945, 35333, 39865, 41665, 42799, 49981, 55245, 57421, 60701, 60787, 65077, 65281, 68101, 72885, 74665, 80581, 85489, 87249, 88357, 91001]