login
Least k such that n divides s(k)-s(j) for some j < k, where s(j) = floor((j+1)^2/2)/2 (quarter-squares).
9

%I #19 Dec 07 2021 13:08:04

%S 2,3,3,4,4,6,5,5,8,6,6,7,9,7,7,8,11,8,8,11,9,12,9,9,14,10,11,10,10,11,

%T 14,11,12,11,11,12,13,12,15,12,12,16,13,14,13,20,13,13,19,14,17,14,20,

%U 14,14,16,21,15,25,15,17,15,15,19,17,16,28,16,17,16,16,17,26

%N Least k such that n divides s(k)-s(j) for some j < k, where s(j) = floor((j+1)^2/2)/2 (quarter-squares).

%C See A204892 for a discussion and guide to related sequences.

%t s[n_] := s[n] = (1/2) Floor[(n + 1)^2/2];

%t z1 = 1000; z2 = 80;

%t Table[s[n], {n, 1, 30}] (* A002620, quarter-squares *)

%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}] (* A205400 *)

%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}] (* A205401 *)

%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}] (* A205402 *)

%t Table[j[n], {n, 1, z2}] (* A205403 *)

%t Table[s[k[n]], {n, 1, z2}] (* A205404 *)

%t Table[s[j[n]], {n, 1, z2}] (* A205405 *)

%t Table[s[k[n]] - s[j[n]], {n, 1, z2}] (* A205406 *)

%t Table[(s[k[n]] - s[j[n]])/n, {n, 1, z2}] (* A198293 *)

%Y Cf. A002620, A205400, A204892.

%K nonn

%O 1,1

%A _Clark Kimberling_, Jan 27 2012

%E Name edited by _Clark Kimberling_, Dec 06 2021