cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A082850 Let S(0) = {}, S(n) = {S(n-1), S(n-1), n}; sequence gives S(infinity).

Original entry on oeis.org

1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 1, 1, 2, 3, 4, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 1, 1, 2, 3, 4, 5, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 1, 1, 2, 3, 4, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 1, 1, 2, 3, 4, 5, 6, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 1, 1, 2, 3, 4, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 1, 1, 2, 3, 4, 5, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 1
Offset: 1

Views

Author

Benoit Cloitre, Apr 14 2003

Keywords

Comments

Sequence counts up to successive values of A001511; i.e., apply the morphism k -> 1,2,...,k to A001511. If all 1's are removed from the sequence, the resulting sequence b has b(n) = a(n)+1. A101925 lists the positions of 1's in this sequence.
The geometric mean of this sequence approaches the Somos constant (A112302). - Jwalin Bhatt, Jan 30 2025

Examples

			S(1) = {1}, S(2) = {1,1,2}, S(3) = {1,1,2,1,1,2,3}, etc.
		

Crossrefs

Cf. A082851 (partial sums).
Cf. A215020.

Programs

  • 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 *)
  • 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 #
    A082850_list = list(islice(A082850_gen(),20)) # Chai Wah Wu, Mar 06 2023

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
a(n) = 1 + A215020(n). - Joerg Arndt, Mar 04 2025