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.

A356348 a(0) = 0; for n > 0, a(n) is the number of preceding terms having the same digit sum as a(n-1).

This page as a plain text file.
%I A356348 #15 Oct 21 2022 17:20:44
%S A356348 0,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,9,1,10,11,2,3,2,4,2,5,2,6,2,7,2,8,
%T A356348 2,9,2,10,12,3,4,3,5,3,6,3,7,3,8,3,9,3,10,13,4,5,4,6,4,7,4,8,4,9,4,10,
%U A356348 14,5,6,5,7,5,8,5,9,5,10,15,6,7,6,8,6,9,6,10,16,7,8,7,9,7,10,17,8,9
%N A356348 a(0) = 0; for n > 0, a(n) is the number of preceding terms having the same digit sum as a(n-1).
%H A356348 Michael De Vlieger, <a href="/A356348/b356348.txt">Table of n, a(n) for n = 0..10000</a>
%H A356348 Scott R. Shannon, <a href="/A356348/a356348.png">Image of n=0..1000000</a>.
%e A356348 a(21) = 2 as a(20) = 11 which has a digit sum of 2, and there has been two previous terms with a digit sum of two: a(3) = 2 and a(20) = 11.
%t A356348 nn = 94; c[_] = 0; a[0] = k = 0; c[0] = 1; Do[a[n] = c[k]; k = Total@ IntegerDigits[a[n]]; c[k]++, {n, nn}]; Array[a, nn] (* _Michael De Vlieger_, Oct 15 2022 *)
%o A356348 (Python)
%o A356348 from itertools import islice
%o A356348 from collections import Counter
%o A356348 def sd(n): return sum(map(int, str(n)))
%o A356348 def agen(): # generator of terms
%o A356348     an, s, inventory = 0, 0, Counter([0])
%o A356348     while True:
%o A356348         yield an; an = inventory[s]; s = sd(an); inventory[s] += 1
%o A356348 print(list(islice(agen(), 95))) # _Michael S. Branicky_, Oct 21 2022
%Y A356348 Cf. A007953, A137671 (base 2), A342585.
%K A356348 nonn,base
%O A356348 0,4
%A A356348 _Scott R. Shannon_, Oct 15 2022