OFFSET
1,2
FORMULA
a(n) = (n-r)^2+(4*r^3+6*r^2+2*r)/3 where r = floor((sqrt(1+8*n)-1)/4). - Simplified by Gerald Hillier, Apr 14 2015
EXAMPLE
First three terms of A128201 are 1, 3, 4, hence a(3) = 1+3+4 = 8.
PROG
(Magma) [(n-r)^2+(4*r^3+6*r^2+2*r)/3 where r is Floor((Sqrt(1+8*n)-1)/4): n in [1..51]];
(PARI) {for(n=1, 51, r=floor((sqrt(1+8*n)-1)/4); print1((n-r)^2+(4*r^3+6*r^2+2*r)/3, ", "))}
CROSSREFS
KEYWORD
nonn
AUTHOR
Gerald Hillier, Feb 23 2009
EXTENSIONS
Edited and extended by Klaus Brockhaus, Feb 24 2009
STATUS
approved