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.

A343878 a(n) is the least k such that A342585(k) = n.

Original entry on oeis.org

1, 2, 5, 9, 11, 21, 25, 30, 47, 39, 59, 71, 96, 100, 126, 115, 160, 178, 197, 217, 221, 261, 243, 265, 336, 322, 374, 419, 397, 479, 425, 485, 551, 583, 649, 618, 723, 653, 801, 690, 727, 887, 930, 974, 889, 932, 1115, 976, 1260, 1310, 1023, 1414, 1070, 1522
Offset: 0

Views

Author

Rémy Sigrist, May 02 2021

Keywords

Comments

The term after the n-th 0 in A342585 is the running total of 0's, and there are infinitely many 0's, so all nonnegative integers appear in A342585. - Peter Munn, May 08 2021

Examples

			We have:
n:       1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21
A342585: 0, 1, 1, 0, 2, 2, 2, 0, 3, 2,  4,  1,  1,  0,  4,  4,  4,  1,  4,  0,  5
So:
- a(0) = 1, a(1) = 2, a(2) = 5, a(3) = 9, a(4) = 11, a(5) = 21.
		

Crossrefs

For records see A347305.

Programs

  • Mathematica
    Block[{a, c, k, m, nn = 54}, c[0] = 1; a = {0}~Join~Reap[Do[k = 0; While[IntegerQ[c[k]], Set[m, c[k]]; Sow[m]; If[IntegerQ@ c[m], c[m]++, c[m] = 1]; k++]; Sow[0]; c[0]++, nn]][[-1, -1]]; TakeWhile[Array[FirstPosition[a, #][[1]] &, nn, 0], IntegerQ]] (* Michael De Vlieger, Oct 12 2021 *)
  • PARI
    See Links section.
    
  • Python
    def A343878(n):
        k, c = 0, dict()
        while True:
            m, r = 0, 1
            while r > 0:
                k += 1
                r = c.get(m,0)
                if n == r:
                    return k
                c[r] = c.get(r,0)+1
                m += 1 # Chai Wah Wu, Aug 31 2021

Formula

For n >= 1, a(n) <= A343880(n) + 1. - Peter Munn, May 08 2021

Extensions

Name shortened by Peter Munn, May 08 2021