login
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.
2

%I #13 May 26 2023 17:58:22

%S 1,2,3,4,6,8,11,15,19,24,30,37,45,53,62,72,83,95,108,122,137,153,169,

%T 186,204,223,243,264,286,309,333,358,384,411,439,468,498,529,561,593,

%U 626,660,695,731,768,806,845,885,926,968,1011,1055,1100,1146,1193,1241

%N 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.

%H Harvey P. Dale, <a href="/A127419/b127419.txt">Table of n, a(n) for n = 0..1000</a>

%F G.f.: A(x) = (1-x+x^3)/(1-x)^3 - x^3/(1-x)^2 * Sum_{k>=0} x^(2^k + k-1).

%F a(n) satisfies: floor((sqrt(8*a(n) - 7) - 1)/2) = A103354(n) for n>=1, where A103354 = floor(x), where x is the solution to x = 2^(n-x).

%e floor( (sqrt(8 * a(n) - 7) - 1)/2 ) = A103354(n) for n>=0:

%e [0,1,1,2,2,3,4,4,5,6,7,8,8,9,10,11,12,13,14,15,16,16,17,...];

%e i.e. the nonnegative integers with powers of 2 repeated.

%e G.f.: A(x) = 1 + 2*x + 3*x^2 + 4*x^3 + 6*x^4 + 8*x^5 + 11*x^6 + ...

%e 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) +...

%t Join[{1},NestList[#+Floor[(Sqrt[8#-7]-1)/2]&,2,60]] (* _Harvey P. Dale_, May 26 2023 *)

%o (PARI) /* Using G.f.: */

%o {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)}

%o (PARI) /* Using Recurrence: */

%o {a(n)=if(n==0,1,if(n==1,2,a(n-1)+(sqrtint(8*a(n-1)-7)-1)\2))}

%Y Cf. A103354.

%K nonn

%O 0,2

%A _Paul D. Hanna_, Jan 13 2007