A127419 Recurrence: a(n) = a(n-1) + floor( (sqrt(8 * a(n-1) - 7) - 1)/2 ) for n>=2 with a(0)=1, a(1)=2.
1, 2, 3, 4, 6, 8, 11, 15, 19, 24, 30, 37, 45, 53, 62, 72, 83, 95, 108, 122, 137, 153, 169, 186, 204, 223, 243, 264, 286, 309, 333, 358, 384, 411, 439, 468, 498, 529, 561, 593, 626, 660, 695, 731, 768, 806, 845, 885, 926, 968, 1011, 1055, 1100, 1146, 1193, 1241
Offset: 0
Keywords
Examples
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) +...
Links
- Harvey P. Dale, Table of n, a(n) for n = 0..1000
Crossrefs
Cf. A103354.
Programs
-
Mathematica
Join[{1},NestList[#+Floor[(Sqrt[8#-7]-1)/2]&,2,60]] (* Harvey P. Dale, May 26 2023 *)
-
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))}