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).
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
Keywords
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.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
- 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.
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 *)
Comments