login
A387170
Self-inventory sequence modulo 10: start with 0; repeatedly append the counts of digits 0..9 seen so far, taken mod 10.
1
0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 9, 2, 1, 0, 0, 0, 0, 0, 0, 1, 5, 4, 1, 0, 1, 1, 0, 0, 0, 1, 9, 8, 1, 0, 1, 1, 0, 0, 1, 2, 2, 2, 4, 0, 2, 1, 0, 0, 1, 2, 5, 4, 6, 0, 3, 2, 1, 0, 1, 2, 7, 6, 8, 1, 3, 2, 2, 1, 2, 2, 7, 8, 2, 2, 3, 2, 2, 2, 3, 2, 7, 8, 8, 4, 4, 2, 2, 3, 5, 2, 7, 8, 1, 5, 5, 5
OFFSET
0,12
COMMENTS
Empirical: The sequence begins to repeat starting at n = 280730 (offset 0) with a period of 63140. That is, for all n >= 280730 we have a(n) = a(n+63140). The repeating block beginning at n = 280730 is (9,9,6,3,8,3,3,4,8,1,1,...).
Empirical: There is exactly one occurrence of a run of 7 consecutive terms with successive differences -1. It starts at n = 16701 and is (7,6,5,4,3,2,1). There are no increasing runs of 7 consecutive terms, and are no runs of length >= 8.
Empirical: The first occurrence of a run of 5 constant values past the initial repeating zeros (that is, beginning with n > 15) starts at n = 8334 and is five 6's in a row. There are no runs of length >= 6 of constant values beginning with n > 14.
LINKS
EXAMPLE
Start with a(0) = 0;
then we append the count of digits 0 seen so far (mod 10): one 0 -> a(1) = 1;
then we append the count of digits 1 seen so far (mod 10): one 1 -> a(2) = 1;
then we append the count of digits 2 seen so far (mod 10): zero 2s -> a(3) = 0;
..
then we append the count of digits 9 seen so far (mod 10): zero 9s -> a(10) = 0;
then we append the count of digits 0 seen so far (mod 10): nine 0s -> a(11) = 9;
then we append the count of digits 1 seen so far (mod 10): two 1s -> a(12) = 2;
then we append the count of digits 2 seen so far (mod 10): one 2 -> a(13) = 1;
etc.
MAPLE
P:=proc(q) local n, v; v:=[0]; for n from 1 to q do
v:=[op(v), numboccur((n-1) mod 10, v) mod 10]; od; op(v); end: P(10^2); Paolo P. Lava, Aug 21 2025
PROG
(JavaScript)
// To generate the first 280730 pre-periodic terms:
var base = 10;
var size = 280730;
var iterations = Math.floor(size/base);
var a = Array(size);
a[0] = 0;
var inventory = Array(base).fill(0);
inventory[0] = 1;
var n = 1;
for (var i = 0; i < iterations; i++) {
for (var target = 0; target < base && n < size; target++, n++) {
var count = inventory[target] % base;
inventory[count]++;
a[n] = count;
}
}
(Python)
from itertools import islice
def agen(): # generator of terms
inventory = [1] + [0]*9
yield 0
while True:
for i in range(10):
yield (c:=inventory[i]%10)
inventory[c%10] += 1
print(list(islice(agen(), 97))) # Michael S. Branicky, Aug 20 2025
CROSSREFS
Cf. A342585.
Sequence in context: A240985 A296460 A379587 * A319533 A010160 A093962
KEYWORD
nonn
AUTHOR
Cameron Johnson, Aug 20 2025
STATUS
approved