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.

A340619 n appears A006519(n) times.

Original entry on oeis.org

1, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 10, 10, 11, 12, 12, 12, 12, 13, 14, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 18, 18, 19, 20, 20, 20, 20, 21, 22, 22, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 26, 26
Offset: 1

Views

Author

Rémy Sigrist, Jan 13 2021

Keywords

Comments

This sequence has similarities with the Cantor staircase function.
This sequence can be seen as an irregular table where the n-th row contains A006519(n) times the value n.
For any k > 1, the set of points { (n, a(n)), n = 1..A006520(2^k-1) } is symmetric; for example, for k = 3, we have the following configuration:
a(n)
^
| *
| **
| *
| ****
| *
| **
|*
+-------------> n

Examples

			The first rows, alongside A006519(n), are:
    n | n-th row               | A006519(n)
   ---+------------------------+-----------
    1 | 1                      |          1
    2 | 2, 2                   |          2
    3 | 3                      |          1
    4 | 4, 4, 4, 4             |          4
    5 | 5                      |          1
    6 | 6, 6                   |          2
    7 | 7                      |          1
    8 | 8, 8, 8, 8, 8, 8, 8, 8 |          8
    9 | 9                      |          1
   10 | 10, 10                 |          2
		

Crossrefs

See A061392 and A340500 for similar sequences.

Programs

  • Mathematica
    A340619[n_] := Array[n &, Table[BitAnd[BitNot[i - 1], i], {i, 1, n}][[n]]];
    Table[A340619[n], {n, 1, 26}] // Flatten (* Robert P. P. McKone, Jan 19 2021 *)
  • PARI
    concat(apply(v -> vector(2^valuation(v,2), k, v), [1..26]))
    
  • PARI
    a(n) = my(ret=0); forstep(k=logint(n,2),0,-1, if(n > k<<(k-1), ret+=1<Kevin Ryde, Jan 18 2021

Formula

a(A006520(n)) = n.
a(A006520(n)+1) = n+1.
a(n) + a(A006520(2^k-1) + 1 - n) = 2^k for any k > 0 and n = 1..A006520(2^k-1).
a(n) = 2^k + (a(r) if r>0), where k such that k*2^(k-1) < n <= (k+1)*2^k and r = n - (k+2)*2^(k-1). - Kevin Ryde, Jan 18 2021