login
A384688
Runs of t in the range 0 <= t <= k and the same parity as k, for successive k >= 0.
4
0, 1, 0, 2, 1, 3, 0, 2, 4, 1, 3, 5, 0, 2, 4, 6, 1, 3, 5, 7, 0, 2, 4, 6, 8, 1, 3, 5, 7, 9, 0, 2, 4, 6, 8, 10, 1, 3, 5, 7, 9, 11, 0, 2, 4, 6, 8, 10, 12, 1, 3, 5, 7, 9, 11, 13, 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15, 0, 2, 4, 6, 8, 10, 12, 14, 16
OFFSET
0,4
COMMENTS
The corresponding k is A055086(n), or k+1 = A000267(n).
A run is 0, 2, 4, ..., k when k even, or 1, 3, 5, ..., k when k odd, and has length floor(k/2) + 1.
Runs start at quarter squares n = A002620(k+1), with those beginning 0 at oblong numbers n = A002378(i) and those starting 1 at the squares n = (i+1)^2 (for i >= 0 in both cases).
Starts to differ from A025643 at n=109.
LINKS
FORMULA
a(n) = 2*r+1 if r < s or a(n) = 2*(r-s) otherwise, where square root and remainder n = s^2 + r being s=A000196(n), r=A053186(n).
a(n) = ceiling(A053186(4*n+1) / 2).
a(n) = A055086(n) - 2*A216607(n+1).
a(n) = 2*A055087(n) + A079813(n+1).
EXAMPLE
Runs and their corresponding k = A055086(n) begin,
n = 0 1 2 4 6 9
a(n) = 0, 1, 0,2, 1,3, 0,2,4, 1,3,5, ...
A055086(n) = 0, 1, 2,2, 3,3, 4,4,4, 5,5,5, ...
MATHEMATICA
ClearAll[a] a[n_Integer]:=Module[{s, r}, s=Floor[Sqrt[n]]; r=n-s^2; If[r<s, 2*r+1, 2*(r-s)]] Table[a[n], {n, 0, 100}] (* Vincenzo Librandi, Jul 06 2025 *)
PROG
(PARI) a(n) = my(r, s=sqrtint(n, &r)); if(r<s, r<<1+1, (r-s)<<1);
CROSSREFS
Cf. A002620, A002378 (indices of 0's), A000290 (indices of 1's).
Sequence in context: A025641 A025649 A025642 * A025643 A127478 A127472
KEYWORD
nonn,easy
AUTHOR
Kevin Ryde, Jun 07 2025
STATUS
approved