OFFSET
1,1
COMMENTS
Equivalently: primes p to p-1 a Novák-Carmichael number A124240.
These p are such that for all x in [0,p), and all b coprime to p-1, x^(b^(p-1)) == x (mod p), this follows from the FLT.
Equivalently, primes p such that for all primes q | p-1, q-1 | p-1. Primes such that p-1 is in A124240. No prime of the form 12k+11 is in this sequence. - Paul Vanderveen, Apr 02 2022
Primes p such that B^(b^(p-1)-1) == 1 (mod p^2) for every B coprime to p and for every b coprime to (p-1)*p. - Thomas Ordowski, Sep 01 2024
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..300 from Harvey P. Dale)
EXAMPLE
7 is in the sequence because it is prime, 1 and 5 are the integers (mod 6) coprime to 6; 1^6 mod 6 = 1; and 5^6 mod 6 = 1.
11 is not in the sequence because 3 is coprime to 10; and 3^10 mod 10 = 9 <> 1.
MATHEMATICA
a={}; For[p=2, p<2600, p=NextPrime[p], b=p-1; While[--b>0&&(GCD[b, p-1]!=1||PowerMod[b, p-1, p-1]==1)]; If[b==0, AppendTo[a, p]]]; a
bcpQ[n_]:=Module[{b=Select[Range[n-2], CoprimeQ[n-1, #]&]}, AllTrue[ b, PowerMod[ #, n-1, n-1]==1&]]; Select[Prime[Range[400]], bcpQ] (* Harvey P. Dale, Jan 01 2022 *)
PROG
(Python)
from math import gcd
from sympy import isprime
def ok(n):
if not isprime(n): return False
return all(pow(b, n-1, n-1) == 1 for b in range(2, n) if gcd(b, n-1)==1)
print([k for k in range(2594) if ok(k)]) # Michael S. Branicky, Apr 02 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Francois R. Grieu, Aug 17 2020
STATUS
approved