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.

A364578 a(n) is the smallest n-digit number whose sum of digits is n.

This page as a plain text file.
%I A364578 #34 Mar 31 2024 16:29:22
%S A364578 1,11,102,1003,10004,100005,1000006,10000007,100000008,1000000009,
%T A364578 10000000019,100000000029,1000000000039,10000000000049,
%U A364578 100000000000059,1000000000000069,10000000000000079,100000000000000089,1000000000000000099,10000000000000000199
%N A364578 a(n) is the smallest n-digit number whose sum of digits is n.
%H A364578 Michael S. Branicky, <a href="/A364578/b364578.txt">Table of n, a(n) for n = 1..1000</a>
%t A364578 Table[Module[{t=10^n},While[Total[IntegerDigits[t]]!=n+1,t++];t],{n,0,20}] (* or *) Join[{1},10^Range[63]+Flatten[Table[(k+1) 10^n-1,{n,0,6},{k,9}]]] (* _Harvey P. Dale_, Mar 31 2024 *)
%o A364578 (PARI) a(n) = my(k=10^(n-1)); while (sumdigits(k) != n, k++); k; \\ _Michel Marcus_, Aug 16 2023
%o A364578 (Python)
%o A364578 def a(n): m=(n-1)//9; return int("1"+"0"*(n-m-2)+str((n-1)%9)*(n>1)+"9"*m)
%o A364578 print([a(n) for n in range(1,21)]) # _Michael S. Branicky_, Aug 16 2023
%Y A364578 Cf. A051885, A202270 (largest instead of smallest).
%K A364578 nonn,base,easy
%O A364578 1,2
%A A364578 _Roland Kneer_, Aug 14 2023