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.
%I A343878 #24 Oct 12 2021 21:54:27 %S A343878 1,2,5,9,11,21,25,30,47,39,59,71,96,100,126,115,160,178,197,217,221, %T A343878 261,243,265,336,322,374,419,397,479,425,485,551,583,649,618,723,653, %U A343878 801,690,727,887,930,974,889,932,1115,976,1260,1310,1023,1414,1070,1522 %N A343878 a(n) is the least k such that A342585(k) = n. %C A343878 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 %H A343878 Rémy Sigrist, <a href="/A343878/b343878.txt">Table of n, a(n) for n = 0..10000</a> %H A343878 Rémy Sigrist, <a href="/A343878/a343878.gp.txt">PARI program for A343878</a> %F A343878 For n >= 1, a(n) <= A343880(n) + 1. - _Peter Munn_, May 08 2021 %e A343878 We have: %e A343878 n: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 %e A343878 A342585: 0, 1, 1, 0, 2, 2, 2, 0, 3, 2, 4, 1, 1, 0, 4, 4, 4, 1, 4, 0, 5 %e A343878 So: %e A343878 - a(0) = 1, a(1) = 2, a(2) = 5, a(3) = 9, a(4) = 11, a(5) = 21. %t A343878 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 *) %o A343878 (PARI) See Links section. %o A343878 (Python) %o A343878 def A343878(n): %o A343878 k, c = 0, dict() %o A343878 while True: %o A343878 m, r = 0, 1 %o A343878 while r > 0: %o A343878 k += 1 %o A343878 r = c.get(m,0) %o A343878 if n == r: %o A343878 return k %o A343878 c[r] = c.get(r,0)+1 %o A343878 m += 1 # _Chai Wah Wu_, Aug 31 2021 %Y A343878 Cf. A342585, A343880. %Y A343878 For records see A347305. %K A343878 nonn,look,easy %O A343878 0,2 %A A343878 _Rémy Sigrist_, May 02 2021 %E A343878 Name shortened by _Peter Munn_, May 08 2021