login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = t for the minimal integer k > t such that k^2 mod n = t^2 is a perfect square.
2

%I #40 Feb 18 2019 20:01:06

%S 0,0,1,0,2,2,2,1,0,3,3,2,3,3,1,0,4,0,4,4,2,4,4,1,0,5,3,5,5,2,5,2,4,5,

%T 1,0,6,6,5,3,6,4,6,6,2,6,6,1,0,0,7,7,7,6,3,5,5,7,7,2,7,7,1,0,4,8,8,8,

%U 7,2,8,3,8,8,5,8,2,7,8,1,0,9,9,4,6,9,7,9,9,4,3,9,8,9,7,2,9,0,1,0,10,8,10,9,4

%N a(n) = t for the minimal integer k > t such that k^2 mod n = t^2 is a perfect square.

%H Alois P. Heinz, <a href="/A306257/b306257.txt">Table of n, a(n) for n = 1..20000</a>

%F a(n) = 0 <=> n > 0 and n in { A000290 } union { A077591 }.

%p a:= proc(n) local k; for k from (s-> `if`(s^2<n, s+1, s))(isqrt(n))

%p while not issqr(irem(k^2, n)) do od; isqrt(irem(k^2, n))

%p end:

%p seq(a(n), n=1..120);

%Y Cf. A000290, A077591, A306271 (values of k).

%K nonn,look

%O 1,5

%A _Alois P. Heinz_, Feb 13 2019