%I #7 Mar 30 2012 18:58:08
%S 2,3,2,3,3,4,4,3,5,6,6,4,7,8,4,5,9,9,10,6,5,12,12,5,10,14,6,8,15,8,16,
%T 6,7,18,6,9,19,20,8,7,21,10,22,12,7,24,24,7,14,15,10,14,27,12,8,9,11,
%U 30,30,8
%N Least k such that n divides k^2-j^2 for some j satisfying 1<=j<k.
%C See A204892 for a discussion and guide to related sequences.
%e 1 divides 2^2-1^2, so a(1)=2
%e 2 divides 3^2-1^2, so a(2)=3
%e 3 divides 2^2-a^2, so a(3)=2
%e 4 divides 3^2-a^2, so a(4)=3
%t s[n_] := s[n] = n^2; z1 = 600; z2 = 60;
%t Table[s[n], {n, 1, 30}] (* A000290 *)
%t u[m_] := u[m] = Flatten[Table[s[k] - s[j], {k, 2, z1}, {j, 1, k - 1}]][[m]]
%t Table[u[m], {m, 1, z1}] (* A120070 *)
%t v[n_, h_] := v[n, h] = If[IntegerQ[u[h]/n], h, 0]
%t w[n_] := w[n] = Table[v[n, h], {h, 1, z1}]
%t d[n_] := d[n] = First[Delete[w[n], Position[w[n], 0]]]
%t Table[d[n], {n, 1, z2}] (* A204994 *)
%t k[n_] := k[n] = Floor[(3 + Sqrt[8 d[n] - 1])/2]
%t m[n_] := m[n] = Floor[(-1 + Sqrt[8 n - 7])/2]
%t j[n_] := j[n] = d[n] - m[d[n]] (m[d[n]] + 1)/2
%t Table[k[n], {n, 1, z2}] (* A204905 *)
%t Table[j[n], {n, 1, z2}] (* A204995 *)
%t Table[s[k[n]], {n, 1, z2}] (* A204996 *)
%t Table[s[j[n]], {n, 1, z2}] (* A204997 *)
%t Table[s[k[n]] - s[j[n]], {n, 1, z2}] (* A204998 *)
%t Table[(s[k[n]] - s[j[n]])/n, {n, 1, z2}] (* A204999 *)
%Y Cf. A000290, A204892.
%K nonn
%O 1,1
%A _Clark Kimberling_, Jan 21 2012