OFFSET
0,4
COMMENTS
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
Vincenzo Librandi, Table of n, a(n) for n = 0..5001
FORMULA
EXAMPLE
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
KEYWORD
nonn,easy
AUTHOR
Kevin Ryde, Jun 07 2025
STATUS
approved
