A377669 a(n) is the least prime p such that (3^p - 3)/p == n (mod p), or -1 if there is no such prime p.
11, 2, 3, 5, 7, 23, 43, 5721619, 2311, 105830189, 31300663, 13, 113, 17, 821, 1181, 19, 37
Offset: 0
Examples
a(4) = 7 because (3^7 - 3)/7 = 312 == 4 (mod 7), and 7 is the first prime that works.
Programs
-
Maple
f:= p -> (3&^p-3 mod p^2)/p: V:= Array(0..17): count:= 0: p:= 1: for i from 1 while count < 23 do p:= nextprime(p); v:= f(p); if v <= 22 and V[v] = 0 then V[v]:= i; count:= count+1 fi; od: convert(V, list);
-
Mathematica
lpp[n_]:=Module[{p=2},While[Mod[(3^p-3)/p,p]!=n,p=NextPrime[p]];p]; Array[lpp,17,0] (* Harvey P. Dale, Jun 07 2025 *)
Formula
a(n) = prime(i) where A179078(i) = n, if such i exists.
Comments