OFFSET
1,2
MATHEMATICA
NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; p = 1; Do[ If[ Mod[p = NextPrim[p], n] == n - 3, Print[n]], {n, 1, 10^9}]
Join[{1, 2}, Select[Range[5 10^6], Mod[Prime[#], #]==#-3&]] (* Harvey P. Dale, Mar 29 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert G. Wilson v, Feb 18 2004
EXTENSIONS
Corrected by Mohammed Bouayoun (bouyao(AT)wanadoo.fr), Feb 20 2004
a(13)-a(22) from Robert G. Wilson v, Feb 22 2006
STATUS
approved