login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A202270 a(n) is the largest n-digit number whose sum of digits is n. 2

%I #24 Aug 16 2023 16:14:03

%S 1,20,300,4000,50000,600000,7000000,80000000,900000000,9100000000,

%T 92000000000,930000000000,9400000000000,95000000000000,

%U 960000000000000,9700000000000000,98000000000000000,990000000000000000,9910000000000000000,99200000000000000000

%N a(n) is the largest n-digit number whose sum of digits is n.

%H Michael S. Branicky, <a href="/A202270/b202270.txt">Table of n, a(n) for n = 1..1000</a>

%p a:= n-> (q-> parse(cat([9$q, r, 0$(n-q-1)][])))(iquo(n, 9, 'r')):

%p seq(a(n), n=1..20); # _Alois P. Heinz_, Aug 16 2023

%o (PARI) a(n) = my(k=10^n-1); while (sumdigits(k) != n, k--); k; \\ _Michel Marcus_, Aug 16 2023

%o (Python)

%o def a(n): return int("9"*(m:=n//9)+str(n%9)+"0"*(n-m-1))

%o print([a(n) for n in range(1,21)]) # _Michael S. Branicky_, Aug 16 2023

%Y Cf. A061219 (without zeros).

%Y Cf. A364578 (smallest n-digit number whose sum of digits is n).

%K nonn,base

%O 1,2

%A _Jaroslav Krizek_, Jan 06 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 22:18 EDT 2024. Contains 371782 sequences. (Running on oeis4.)