OFFSET
1,7
COMMENTS
By the pigeonhole principle, a(n) is upper bounded by n^n - n.
LINKS
Elad Michael, Table of n, a(n) for n = 1..100
Reddit user supermac30, Foggy Sequences.
EXAMPLE
The sequence b(3, m) is 1, 1, 2, 1, 2, 2, 2, 3, 1, 1, 2, ... which is periodic at index 1 with period 8.
The sequence b(8, m) is 1, 1, 2, 1, 3, 1, 4, ... 3, 4, 1, 2, 3, 3, 4, 2, 2, 3, 3, 4, 2, 3, 3, 4, 2, 2, 3, 3, ... which is periodic at index 24 with period 9.
PROG
(Python)
def a(n):
b = [1];
for i in range(2, n+1):
b.append(b.count(b[-1]));
prev = {tuple(b):1};
m = 1;
while(True):
b.append(b.count(b[-1]));
del b[0];
m += 1;
if(tuple(b) in prev):
return prev[tuple(b)]
else:
prev[tuple(b)] = m;
CROSSREFS
KEYWORD
nonn
AUTHOR
Elad Michael, May 30 2020
STATUS
approved