%I #32 Jul 21 2026 09:34:37
%S 3,17,199,22051,387199,52246349,3753373051,3884699495951
%N Smallest prime p such that p^(q^3) = +-1 mod q^5 is true when q is any of the first n primes.
%H Rhys Feltman, <a href="/A396786/a396786.txt">Python code</a>
%e a(1) = 3 because 3^(2^3) mod 2^5 = +-1: 3^8 = 6561. 6561 = 205*32 (6560) + 1. Prime 2 obviously does not work because 2^m mod 2^n will always be either 0 or 2^m.
%o (PARI) isok(p, vp) = for (i=1, #vp, my(q=vp[i], q5=q^5, m=Mod(p, q5)^q^3); if ((m != Mod(1, q5)) && (m != Mod(-1, q5)), return(0));); 1;
%o a(n) = my(p=2, vp=primes(n)); while (!isok(p, vp), p=nextprime(p+1)); p; \\ _Michel Marcus_, Jun 13 2026
%Y Cf. A395587 (with q^2 instead of q^3).
%K nonn,more,changed
%O 1,1
%A _Rhys Feltman_, Jun 05 2026
%E a(6) from _Michel Marcus_, Jun 13 2026
%E a(7)-a(8) from _Max Alekseyev_, Jul 15 2026