while True: a=input();print(a&-~a<1)and a>1 and all(a%b for b in range(2,a)) print(a,)
1 2 3 4 5 6 7 8 9 20 23 28 29 31 51 127 128 1023 1024 8191
False (1,) False (2,) True (3,) False (4,) False (5,) False (6,) True (7,) False (8,) False (9,) False (20,) False (23,) False (28,) False (29,) True (31,) False (51,) True (127,) False (128,) False (1023,) False (1024,) True (8191,)
Traceback (most recent call last): File "prog.py", line 3, in <module> EOFError: EOF when reading a line