login
A065988
a(n) is the largest prime p < n such that n mod p is a perfect square; a(n) = 0 if no such prime exists.
1
0, 0, 2, 3, 2, 5, 3, 7, 5, 5, 7, 11, 3, 13, 11, 5, 13, 17, 5, 19, 17, 13, 19, 23, 7, 17, 23, 19, 7, 29, 11, 31, 29, 17, 31, 7, 11, 37, 23, 31, 37, 41, 17, 43, 41, 37, 43, 47, 7, 41, 47, 43, 37, 53, 23, 47, 53, 29, 43, 59, 19, 61, 59, 11, 61, 41, 29, 67, 53, 61, 67, 71, 37, 73, 71
OFFSET
1,3
LINKS
MATHEMATICA
lp[n_]:=Module[{p=Prime[PrimePi[n]]}, p=If[p==n, NextPrime[p, -1], p]; While[ !IntegerQ[ Sqrt[Mod[n, p]]], p=NextPrime[p, -1]]; p]; Join[{0, 0}, Array[lp, 80, 3]] (* Harvey P. Dale, Apr 23 2022 *)
PROG
(PARI) { for (n=1, 1000, p=precprime(n - 1);; while (p > 0 && !issquare(n%p), p=precprime(p - 1)); write("b065988.txt", n, " ", p) ) } \\ Harry J. Smith, Nov 05 2009
CROSSREFS
Sequence in context: A079311 A364391 A060474 * A335285 A336268 A075105
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Dec 10 2001
STATUS
approved