OFFSET
1,2
COMMENTS
Basis for sequence is shortest arithmetic sequence with initial term n and difference 1 that sums to a perfect square. Cf. A100251, A100252, A100253, A100254.
0 <= a(n) <= 2*(n - 1). - Ctibor O. Zizka, Oct 05 2023
LINKS
Shawn A. Broyles, Table of n, a(n) for n = 1..1000
FORMULA
a(n^2) = 0. - Michel Marcus, Jun 28 2013
EXAMPLE
a(11)=2 since j=2 is the smallest integer for which 11+...+11+j = 6^2 = 36 is a perfect square.
PROG
(PARI) a(n) = {j = 0; while(! issquare(sum(k=0, j, n+k)), j++); j; } \\ Michel Marcus, Sep 01 2013
CROSSREFS
KEYWORD
nonn
AUTHOR
Charlie Marion, Dec 29 2004
EXTENSIONS
More terms from Michel Marcus, Jun 28 2013
STATUS
approved