OFFSET
1,3
COMMENTS
FORMULA
a(2^m - 1) = m.
If n = 2^m - 1 + k with 0 < k < 2^m, then a(n) = a(k). - Franklin T. Adams-Watters, Aug 16 2006
a(n) = log_2(A182105(n)) + 1. - Laurent Orseau, Jun 18 2019
EXAMPLE
S(1) = {1}, S(2) = {1,1,2}, S(3) = {1,1,2,1,1,2,3}, etc.
MATHEMATICA
Fold[Flatten[{#1, #1, #2}] &, {}, Range[5]] (* Birkas Gyorgy, Apr 13 2011 *)
Flatten[Table[Length@Last@Split@IntegerDigits[2 n, 2], {n, 20}] /. {n_ ->Range[n]}] (* Birkas Gyorgy, Apr 13 2011 *)
PROG
(Python)
S = []; [S.extend(S + [n]) for n in range(1, 8)]
print(S) # Michael S. Branicky, Jul 02 2022
(Python)
from itertools import count, islice
def A082850_gen(): # generator of terms
S = []
for n in count(1):
yield from (m:=S+[n])
S += m #
CROSSREFS
KEYWORD
nonn,hear
AUTHOR
Benoit Cloitre, Apr 14 2003
STATUS
approved