Before trying the problem "note your opinion as to whether the observed pattern is known to continue, known not to continue, or not known at all."
For integers greater than 1,
2^{n} is never congruent to 1 (mod n)
2^{n} is congruent to 2 (mod n) whenever n is prime, and sometimes when it isn't,
is 2^{n} ever congruent to 3 (mod n)?
I had no preconception of what might result.
Part 1:
10 for N=2 to 50000
30 R=modpow(2,N,N)
40 if R=1 then print N,R
50 next
finds no congruence to 1.
Part 2:
10 for N=2 to 5000
30 R=modpow(2,N,N)
40 if R=2 and prmdiv(N)<>N then print N,
45 if prmdiv(N)=N and N<>1 and R<>2 then print "*****";N;"******",
50 next
finds the only exception, when n is prime and 2^n is not congruent to 2 mod n occurs when n=2. Indeed it found, as expected, composites with 2^n congruent to 2: 341, 561, 645, 1105, 1387, 1729, 1905, 2047, 2465, 2701, 2821, 3277, 4033, 4369, 4371, 4681; presumably such sporadics continue past 5000.
Part 3:
10 for N=2 to 50000
30 R=modpow(2,N,N)
40 if R=3 then print N,
50 next
finds no value congruent to 3 mod n.
After reading Daniel's post, this latter did not go far enough.

Posted by Charlie
on 20170924 16:53:43 