login
A309872
For each term, take the last digit of the previous term and count all the appearances of that digit up to and including the previous term; the first term is 1.
1
1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 12, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2, 10, 2, 11, 16, 3, 3, 4, 3, 5, 3, 6, 4, 4, 5, 4, 6, 5, 5, 6, 6, 7, 3, 7, 4, 7, 5, 7, 6, 8, 3, 8, 4, 8, 5, 8, 6, 9, 3, 9, 4, 9, 5, 9, 6, 10, 3, 10, 4, 10, 5, 10, 6, 11, 23, 11
OFFSET
1,3
LINKS
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
Cf. A248034 (first term is 0).
Sequence in context: A318225 A360257 A335497 * A359031 A248034 A358967
KEYWORD
base,nonn,look
AUTHOR
Maxim Skorohodov, Aug 21 2019
STATUS
approved