I'm working on this code to calculate Fermat's Little Theorem and it works as it should. The only issue that I have is that I would hope for it to be more efficient. Is there a way to limit the print to only true congruences?
for i in range (1,351):
print i, [(2 << i - 2) % i == 1]