login
A376908
a(0) = 0. For n >= 0, if a(n-1) is a novel term, a(n) = a(a(n-1)). If a(n-1) > 0 has been seen k(>1) times, a(n) = k*a(n-1), unless k*a(n-1) > n, in which case a(n) = 0. If a(n-1) = 0 has been seen k(>1) times, a(n) = k.
2
0, 0, 2, 2, 4, 4, 0, 3, 2, 6, 0, 4, 12, 12, 0, 5, 4, 16, 4, 0, 6, 12, 0, 7, 3, 6, 18, 4, 24, 3, 9, 6, 24, 0, 8, 2, 8, 16, 32, 24, 0, 9, 18, 36, 8, 24, 0, 10, 0, 11, 4, 28, 24, 0, 12, 48, 0, 13, 12, 0, 14, 0, 15, 5, 10, 20, 6, 30, 9, 27, 4, 32, 64, 10, 30, 60, 14
OFFSET
0,3
COMMENTS
It seems that a(n) <= n with equality (in first 2^24 terms) only for n = 0,2,4,12,200, 216, 360, 2646.
a(n-1) = 0 is followed by k, the number of zeros seen so far, (rather than k*a(n-1) as for nonzero terms), otherwise the sequence would contain only zeros. The a(n) = 0 clause is necessary to ensure continuation of the sequence at points, since without it there would be occasions where a(n) = a(a(m)) but a(m) is not yet defined. The first such instance follows a(5) = 4, the second time 4 appears, upon which we would have a(6) = 2*4 = 8, a novel term so a(7) = a(a(8)), but a(8) is not yet defined. By setting a(6) = 0 the sequence can continue (see Example).
LINKS
Michael De Vlieger, Log log scatterplot of a(n) n = 0..2^20, showing a(n) = 0 instead as a(n) = 1/2 in red for visibility.
EXAMPLE
a(0) = 0 a novel term, implies a(1) = a(a(0)) = a(0) = 0.
Now we have a(0) = a(1) = 0, so k = 2, which from the definition means a(2) = 2.
a(2) = 2 is a novel term so a(3) = a(a(2)) = a(2) = 2.
Because 2 has occurred twice we have a(4) = 2*2 = 4.
a(4) = 4 is a novel term so a(5) = a(a(4)) = a(4) = 4, the second occurrence of 4.
Since 2*4 = 8 exceeds 6, the index of the next term we invoke the 0 clause so a(6) = 0.
Now 0 has occurred three times, so a(7) = 3, a novel term making a(8) = a(a(3)) = 2.
MATHEMATICA
nn = 120; c[_] := 0; j = a[0] = 0;
Do[If[c[j] == 0,
k = a[j],
If[j == 0,
k = c[0] + 1,
If[# > n, k = 0, k = #] &[j*(c[j] + 1)] ] ];
c[j]++; Set[{a[n], j}, {k, k}], {n, nn}];
Array[a, nn, 0] (* Michael De Vlieger, Oct 10 2024 *)
CROSSREFS
Cf. A377027.
Sequence in context: A323257 A054529 A074934 * A376339 A089886 A324648
KEYWORD
nonn
AUTHOR
EXTENSIONS
More terms from Michael De Vlieger, Oct 10 2024
STATUS
approved