login
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).
2
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,3
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.
LINKS
Michael De Vlieger, Log log scatterplot of a(n), n = 3..2^20.
Michael De Vlieger, Log log scatterplot of a(n), n = 3..2^16, with a color function showing m = A000120(a(n-1)) in black for m = 0, red for m = 1, orange for m = 2, ..., magenta for m = 12.
EXAMPLE
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.
MATHEMATICA
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 *)
CROSSREFS
Cf. A000120.
Sequence in context: A235187 A029333 A029261 * A100480 A373052 A268811
KEYWORD
nonn
AUTHOR
STATUS
approved