OFFSET
0,3
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..5000
FORMULA
a(n+1) = a(n) + floor(Log(2, a(n))) + 1, with a(0) = 0, a(1) = 1.
MAPLE
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