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.

A138471 Number of numbers less than n having the same sum of digits.

This page as a plain text file.
%I A138471 #21 May 26 2017 03:21:15
%S A138471 0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,2,2,2,2,2,2,2,2,1,0,3,3,3,3,
%T A138471 3,3,3,2,1,0,4,4,4,4,4,4,3,2,1,0,5,5,5,5,5,4,3,2,1,0,6,6,6,6,5,4,3,2,
%U A138471 1,0,7,7,7,6,5,4,3,2,1,0,8,8,7,6,5,4,3,2,1,0,9,8,7,6,5,4,3,2,1,0,2,3,4,5,6
%N A138471 Number of numbers less than n having the same sum of digits.
%C A138471 A138470(n) + a(n) + A138472(n) = n;
%C A138471 a(A051885(n)) = 0.
%C A138471 a(A228915(n)) = a(n)+1. - _Robert Israel_, May 26 2017
%H A138471 Robert Israel, <a href="/A138471/b138471.txt">Table of n, a(n) for n = 0..10000</a> (terms 0..1500 from Reinhard Zumkeller)
%H A138471 <a href="/index/Coi#Colombian">Index entries for Colombian or self numbers and related sequences</a>
%e A138471 a(42)=#{6,15,24,33}=4.
%p A138471 N:= 1000: # to get a(0) to a(N)
%p A138471 C:= Vector(9*(1+ilog10(N))):
%p A138471 A[0]:= 0:
%p A138471 for n from 1 to N do
%p A138471   s:= convert(convert(n,base,10),`+`);
%p A138471   A[n]:= C[s];
%p A138471   C[s]:= C[s]+1;
%p A138471 od:
%p A138471 seq(A[i],i=0..N); # _Robert Israel_, May 25 2017
%t A138471 Module[{nn=110,sd},sd=Total[IntegerDigits[#]]&/@Range[nn];Join[{0},Table[ Count[Take[sd,i-1],sd[[i]]],{i,nn}]]] (* _Harvey P. Dale_, Aug 14 2013 *)
%o A138471 (PARI) a(n) = my(sdn=sumdigits(n)); sum(k=1, n-1, sumdigits(k) == sdn); \\ _Michel Marcus_, May 26 2017
%Y A138471 Cf. A007953, A051885, A138470, A138472, A228915.
%K A138471 nonn,base,look
%O A138471 0,21
%A A138471 _Reinhard Zumkeller_, Mar 19 2008