OFFSET
1,3
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
To get the eleventh term, you need to get the last digit of the tenth term, which is 1, and then count all the 1's already in the sequence: 1, 1, 2, 1, 3, 1, 4, 1, 5, 1; there are six 1's, so the eleventh term is 6.
MAPLE
Q:= Array(0..9):
A:= Vector(100):
Q[1]:= 1:
A[1]:= 1:
for n from 2 to 100 do
d:= A[n-1] mod 10;
A[n]:= Q[d];
L:= convert(%, base, 10);
for i in L do Q[i]:= Q[i]+1 od
od:
convert(A, list); # Robert Israel, Feb 18 2020
PROG
(PARI) f = vector(base=10); for (n=1, 91, v = if (n==1, 1, f[1+(v%base)]); apply (d -> f[1+d]++, if (v, digits(v, base), [0])); print1 (v ", ")) \\ Rémy Sigrist, Aug 21 2019
(Python)
s, a, n = "1", [1], 1
while n < 100:
n = n+1
d = s[len(s)-1]
i, aa = 0, 0
while i < len(s):
if s[i] == d:
aa = aa+1
i = i+1
s, a = s+str(aa), a+[aa]
for n in range(1, 92): print(a[n-1], end=', ') # A.H.M. Smeets, Aug 22 2019
CROSSREFS
KEYWORD
AUTHOR
Maxim Skorohodov, Aug 21 2019
STATUS
approved