OFFSET
0,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
FORMULA
EXAMPLE
floor( (sqrt(8 * a(n) - 7) - 1)/2 ) = A103354(n) for n>=0:
[0,1,1,2,2,3,4,4,5,6,7,8,8,9,10,11,12,13,14,15,16,16,17,...];
i.e. the nonnegative integers with powers of 2 repeated.
G.f.: A(x) = 1 + 2*x + 3*x^2 + 4*x^3 + 6*x^4 + 8*x^5 + 11*x^6 + ...
G.f.: A(x) = (1-x+x^3)/(1-x)^3 - x^3/(1-x)^2 * B(x) where B(x) = 1 + x^2 + x^5 + x^10 + x^19 + x^36 + x^69 +...+ x^(2^n+n-1) +...
MATHEMATICA
Join[{1}, NestList[#+Floor[(Sqrt[8#-7]-1)/2]&, 2, 60]] (* Harvey P. Dale, May 26 2023 *)
PROG
(PARI) /* Using G.f.: */
{a(n)=local(x=X+X*O(X^n)); polcoeff((1-x+x^3)/(1-x)^3 - x^3/(1-x)^2*(sum(k=0, #binary(n), x^(2^k+k-1))), n, X)}
(PARI) /* Using Recurrence: */
{a(n)=if(n==0, 1, if(n==1, 2, a(n-1)+(sqrtint(8*a(n-1)-7)-1)\2))}
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul D. Hanna, Jan 13 2007
STATUS
approved