OFFSET
1,4
COMMENTS
After 1 1 1 3 1, we see "4 1's, 0 2's and 1 3", so next terms are 4 1 0 2 3 1.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20377 (first 55 steps)
EXAMPLE
Row n lists all terms written at the n-th step:
1;
1, 1;
3, 1;
4, 1, 0, 2, 1, 3;
1, 0, 6, 1, 1, 2, 2, 3, 1, 4;
2, 0, 10, 1, 3, 2, 3, 3, 2, 4, 0, 5, 1, 6;
4, 0, 12, 1, 6, 2, 6, 3, 3, 4, 1, 5, 2, 6, 0, 7, 0, 8, 0, 9, 1, 10;
...
MAPLE
b:= proc(n) option remember; `if`(n<1, 0, b(n-1)+add(x^i, i=T(n))) end:
T:= proc(n) option remember; `if`(n=1, 1, (p->
seq([coeff(p, x, i), i][], i=ldegree(p)..degree(p)))(b(n-1)))
end:
seq(T(n), n=1..10); # Alois P. Heinz, Aug 24 2025
MATHEMATICA
s={1}; Do[s=Flatten[{s, {Count[s, #], #}&/@Range[Min[s], Max[s]]}], {20}]; s (* Peter J. C. Moses, Mar 21 2013 *)
PROG
(Python)
from itertools import islice
def agen(): # generator of terms
a = [1]
yield 1
while True:
counts = []
for d in range(min(a), max(a)+1):
c = a.count(d)
counts.extend([c, d])
a += counts
yield from counts
print(list(islice(agen(), 84))) # Michael S. Branicky, Aug 24 2025
CROSSREFS
KEYWORD
nonn,base,tabf
AUTHOR
N. J. A. Sloane, Jan 26 2003
EXTENSIONS
More terms from Sean A. Irvine, Aug 24 2025
STATUS
approved
