cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A309872 #25 Feb 19 2020 01:33:46
%S A309872 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,
%T A309872 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,
%U A309872 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
%N 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.
%H A309872 Robert Israel, <a href="/A309872/b309872.txt">Table of n, a(n) for n = 1..10000</a>
%e A309872 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.
%p A309872 Q:= Array(0..9):
%p A309872 A:= Vector(100):
%p A309872 Q[1]:= 1:
%p A309872 A[1]:= 1:
%p A309872 for n from 2 to 100 do
%p A309872   d:= A[n-1] mod 10;
%p A309872   A[n]:= Q[d];
%p A309872   L:= convert(%,base,10);
%p A309872   for i in L do Q[i]:= Q[i]+1 od
%p A309872 od:
%p A309872 convert(A,list); # _Robert Israel_, Feb 18 2020
%o A309872 (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
%o A309872 (Python)
%o A309872 s, a, n = "1", [1], 1
%o A309872 while n < 100:
%o A309872     n = n+1
%o A309872     d = s[len(s)-1]
%o A309872     i, aa = 0, 0
%o A309872     while i < len(s):
%o A309872         if s[i] == d:
%o A309872             aa = aa+1
%o A309872         i = i+1
%o A309872     s, a = s+str(aa), a+[aa]
%o A309872 for n in range(1, 92): print(a[n-1], end=', ') # _A.H.M. Smeets_, Aug 22 2019
%Y A309872 Cf. A248034 (first term is 0).
%K A309872 base,nonn,look
%O A309872 1,3
%A A309872 _Maxim Skorohodov_, Aug 21 2019