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.

A112395 Next term is the sum of the previous 10 digits in the sequence.

This page as a plain text file.
%I A112395 #16 Oct 04 2024 08:51:55
%S A112395 0,0,0,0,0,0,0,0,0,1,1,2,4,8,16,23,28,37,44,40,37,42,38,39,43,46,46,
%T A112395 50,44,40,37,37,37,42,40,40,34,31,25,26,30,29,33,35,36,37,44,41,40,36,
%U A112395 36,35,35,38,45,45,45,46,48,49,53,52,50,45,42,35,35,36,40,35,37,39,43,41
%N A112395 Next term is the sum of the previous 10 digits in the sequence.
%C A112395 Digits, not terms!
%C A112395 There are only 10^10 possibilities for the last 10 digits, so the sequence must eventually cycle.
%C A112395 Cycles at n(19) = 44 and the loop has 312 terms. - _Hans Havermann_
%C A112395 Terms computed by Gilles Sadowski.
%H A112395 Michael S. Branicky, <a href="/A112395/b112395.txt">Table of n, a(n) for n = 1..331</a> (through first loop)
%e A112395 0 + 0 + 1 + 1 + 2 + 4 + 8 + 1 + 6 = 23
%t A112395 a[1] = a[2] = a[3] = a[4] = a[5] = a[6] = a[7] = a[8] = a[9] = 0; a[10] = 1; a[n_] := a[n] = Plus @@ Take[ Flatten@Table[IntegerDigits[a[i]], {i, n - 10, n - 1}], -10]; Array[a, 74] (* _Robert G. Wilson v_, Dec 09 2005 *)
%o A112395 (Python)
%o A112395 from itertools import islice
%o A112395 def agen(): # generator of terms
%o A112395     last10 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
%o A112395     print(last10[:0])
%o A112395     yield from last10
%o A112395     while True:
%o A112395         an = sum(last10)
%o A112395         yield an
%o A112395         d = list(map(int, str(an)))
%o A112395         last10 = last10[-max(10-len(d), 0):] + d[-min(len(d), 10):]
%o A112395 print(list(islice(agen(), 74))) # _Michael S. Branicky_, Oct 03 2024
%K A112395 base,easy,nonn
%O A112395 1,12
%A A112395 _Eric Angelini_, Dec 05 2005