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.

A359384 a(1) = 0. If a(n-1) is a first occurrence, a(n) = A000120(a(n-1)). Otherwise, if a(n-1) is a repeat of a prior terms, a(n) = number of indices j < n such that a(j) = a(n-1).

Original entry on oeis.org

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

Views

Author

David James Sycamore, Dec 27 2022

Keywords

Comments

In other words, a novel term is followed by its binary weight and a repeat term is followed by its cardinality. The sequence is infinite, and all nonzero numbers appear infinitely many times. Zero occurs just twice because it is the only number with zero binary weight. 1 occurs following powers of 2.
a(n) < n.

Examples

			a(8) = 3, a novel term, therefore a(9) = 2, the binary weight of 3.
a(12) = 3, occurring for the 2nd time, so a(13) = 2.
		

Crossrefs

Programs

  • Mathematica
    Block[{a, c, f, k, nn}, nn = 80; c[] = 0; a[1] = 0; f[n] := DigitCount[n, 2, 1]; Do[If[c[#] == 0, c[#]++; Set[k, f[#]], c[#]++; Set[k, c[#]]] &[a[n - 1]]; a[n] = k, {n, 2, nn}]; Array[a, nn] ] (* Michael De Vlieger, Dec 28 2022 *)