login
A362502
Least k > 0 such that (floor(sqrt(n*k)) + 1)^2 mod n is a square.
2
1, 1, 1, 1, 1, 2, 3, 1, 3, 4, 5, 1, 7, 8, 1, 1, 9, 4, 11, 2, 1, 14, 15, 1, 8, 16, 1, 3, 19, 2, 21, 1, 3, 24, 1, 2, 25, 26, 3, 1, 29, 2, 31, 6, 1, 34, 35, 1, 15, 4, 3, 7, 39, 4, 1, 2, 3, 44, 45, 1, 47, 48, 1, 2, 1, 4, 51, 10, 5, 2, 55, 1, 57, 58, 5, 12, 1, 6, 63, 1, 5, 64, 65, 1, 3, 68
OFFSET
1,6
LINKS
MATHEMATICA
nmax=86; a={}; For[n=1, n<=nmax, n++, For[k=1, k>0, k++, If[IntegerQ[Sqrt[Mod[Floor[Sqrt[n k]+1]^2, n]]], AppendTo[a, k]; k=-1]]]; a (* Stefano Spezia, Apr 24 2023 *)
PROG
(Python)
from gmpy2 import is_square, isqrt
def a(n):
m, k = 2, 0
while not is_square(m):
k+=1
m = pow(isqrt(n * k) + 1, 2, n)
return k
(PARI) a(n) = my(k=1); while(!issquare((sqrtint(n*k)+1)^2 % n), k++); k; \\ Michel Marcus, Apr 24 2023
CROSSREFS
Sequence in context: A185311 A338764 A214582 * A050375 A300724 A352686
KEYWORD
nonn
AUTHOR
Darío Clavijo, Apr 22 2023
STATUS
approved