%I #36 May 29 2023 00:08:27
%S 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,
%T 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,
%U 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
%N Least k > 0 such that (floor(sqrt(n*k)) + 1)^2 mod n is a square.
%H Winston de Greef, <a href="/A362502/b362502.txt">Table of n, a(n) for n = 1..10000</a>
%t 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 *)
%o (Python)
%o from gmpy2 import is_square, isqrt
%o def a(n):
%o m,k = 2,0
%o while not is_square(m):
%o k+=1
%o m = pow(isqrt(n * k) + 1, 2, n)
%o return k
%o (PARI) a(n) = my(k=1); while(!issquare((sqrtint(n*k)+1)^2 % n), k++); k; \\ _Michel Marcus_, Apr 24 2023
%K nonn
%O 1,6
%A _DarĂo Clavijo_, Apr 22 2023
|