login

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”).

A088236
Total number of digits (in base 2) in all preceding terms in the sequence.
2
0, 1, 2, 4, 7, 10, 14, 18, 23, 28, 33, 39, 45, 51, 57, 63, 69, 76, 83, 90, 97, 104, 111, 118, 125, 132, 140, 148, 156, 164, 172, 180, 188, 196, 204, 212, 220, 228, 236, 244, 252, 260, 269, 278, 287, 296, 305, 314, 323, 332, 341, 350, 359, 368, 377, 386, 395
OFFSET
0,3
LINKS
FORMULA
a(n+1) = a(n) + floor(Log(2, a(n))) + 1, with a(0) = 0, a(1) = 1.
MAPLE
A070939 := n -> `if`(n=0, 1, ilog2(2*n)):
A088236 := proc(n) option remember;
if n=0 then 1
else A088236(n-1) + A070939(A088236(n-1)); fi;
end proc; # N. J. A. Sloane, Aug 30 2022
MATHEMATICA
a[n_]:= a[n]= If[n<2, n, a[n-1] + Floor[Log2[a[n-1]]] +1];
Table[a[n], {n, 0, 100}] (* G. C. Greubel, Dec 10 2015; Jul 24 2022 *)
Join[{0}, NestList[#+IntegerLength[#, 2]&, 1, 60]] (* Harvey P. Dale, May 14 2024 *)
PROG
(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
(SageMath)
@CachedFunction
def a(n): return n if (n<2) else a(n-1) + floor(log(a(n-1), 2)) + 1 # a = A088236
[a(n) for n in (0..100)] # G. C. Greubel, Jul 24 2022
(Python)
from itertools import islice
def agen():
yield 0; an = 1
while True: yield an; an += an.bit_length()
print(list(islice(agen(), 57))) # Michael S. Branicky, Jul 24 2022
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
David Corbett (dcorbett42(AT)yahoo.co.nz), Sep 25 2003
STATUS
approved