OFFSET
0,4
COMMENTS
The sequence consists of ascending runs of length 3 or 4. The first run starts at n = 1 and thereafter the k-th run starts at n = A214858(k - 1). - John Tyler Rascoe, Nov 05 2022
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..10000
FORMULA
a(n) = (ceiling(sqrt(n*(n+1)/2)))^2 - n*(n+1)/2. - Ctibor O. Zizka, Nov 09 2009
MATHEMATICA
Ceiling[Sqrt[#]]^2-#&/@Accumulate[Range[0, 80]] (* Harvey P. Dale, Aug 25 2013 *)
PROG
(PARI) a(n) = my(t=n*(n+1)/2); if (issquare(t), 0, (sqrtint(t)+1)^2 - t); \\ Michel Marcus, Nov 06 2022
CROSSREFS
KEYWORD
AUTHOR
Ctibor O. Zizka, Nov 09 2009
EXTENSIONS
Erroneous formula variant deleted and offset set to zero by R. J. Mathar, Aug 24 2010
STATUS
approved