%I #22 Sep 08 2022 08:46:13
%S 17,257,8209,65537,649801
%N Primes p such that (p-1)^2+1 divides 2^(p-1)-1.
%C a(6), if it exists, is larger than 1.7*10^12. - _Giovanni Resta_, Jul 23 2015
%C N = 1382401 is the smallest composite number such that (n-1)^2+1 divides 2^(n-1)-1, cf. A260407; see also A081762 and A260406. The sequence contains all Fermat primes 2^2^k+1 > 5 (A019434). - _M. F. Hasler_, Jul 24 2015
%e 17 is in this sequence because (17 - 1)^2 + 1 = 257 divides 2^(17 - 1) - 1 = 65535; 65535 / 257 = 255.
%t fQ[n_] := PowerMod[2, n-1, (n-1)^2 + 1] == 1; p = 2; lst = {}; While[p < 10^9, If[ fQ@ p, AppendTo[lst, p]]; p = NextPrime@ p] (* _Robert G. Wilson v_, Jul 24 2015 *)
%o (Magma) [n: n in [1..2000000] | IsPrime(n) and (2^(n-1)-1) mod ((n-1)^2 + 1) eq 0]
%Y Cf. A081762 (primes p such that (p-1)^2 - 1 divides 2^(p-1) - 1).
%K nonn,more
%O 1,1
%A _Jaroslav Krizek_, Jul 22 2015