Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #31 Jul 21 2024 21:24:32
%S 0,1,2,4,7,10,14,18,23,28,33,39,45,51,57,63,69,76,83,90,97,104,111,
%T 118,125,132,140,148,156,164,172,180,188,196,204,212,220,228,236,244,
%U 252,260,269,278,287,296,305,314,323,332,341,350,359,368,377,386,395
%N Total number of digits (in base 2) in all preceding terms in the sequence.
%H G. C. Greubel, <a href="/A088236/b088236.txt">Table of n, a(n) for n = 0..5000</a>
%F a(n+1) = a(n) + floor(Log(2, a(n))) + 1, with a(0) = 0, a(1) = 1.
%p A070939 := n -> `if`(n=0, 1, ilog2(2*n)):
%p A088236 := proc(n) option remember;
%p if n=0 then 1
%p else A088236(n-1) + A070939(A088236(n-1)); fi;
%p end proc; # _N. J. A. Sloane_, Aug 30 2022
%t a[n_]:= a[n]= If[n<2, n, a[n-1] + Floor[Log2[a[n-1]]] +1];
%t Table[a[n], {n,0,100}] (* _G. C. Greubel_, Dec 10 2015; Jul 24 2022 *)
%t Join[{0},NestList[#+IntegerLength[#,2]&,1,60]] (* _Harvey P. Dale_, May 14 2024 *)
%o (PARI) alist(n) = my(r=vector(n),val=0,delta=1,pow=2); for(i=2,n,r[i]=val+=delta;if(val>=pow,delta++;pow*=2));r \\ _Franklin T. Adams-Watters_, Oct 11 2014
%o (SageMath)
%o @CachedFunction
%o def a(n): return n if (n<2) else a(n-1) + floor(log(a(n-1),2)) + 1 # a = A088236
%o [a(n) for n in (0..100)] # _G. C. Greubel_, Jul 24 2022
%o (Python)
%o from itertools import islice
%o def agen():
%o yield 0; an = 1
%o while True: yield an; an += an.bit_length()
%o print(list(islice(agen(), 57))) # _Michael S. Branicky_, Jul 24 2022
%Y Cf. A010062, A070939, A088235.
%K base,easy,nonn
%O 0,3
%A David Corbett (dcorbett42(AT)yahoo.co.nz), Sep 25 2003