def is_good(n): return pow(2, n, n) == 2 % n and pow(3, n, n) != 3 % n result = [] limit = 100000# đổi tùy ý for n in range(2, limit+1): if is_good(n): result.append(n) print(result)
Standard input is empty
[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]