A052220 Numbers whose sum of digits is 6.
6, 15, 24, 33, 42, 51, 60, 105, 114, 123, 132, 141, 150, 204, 213, 222, 231, 240, 303, 312, 321, 330, 402, 411, 420, 501, 510, 600, 1005, 1014, 1023, 1032, 1041, 1050, 1104, 1113, 1122, 1131, 1140, 1203, 1212, 1221, 1230, 1302, 1311, 1320, 1401, 1410
Offset: 1
Examples
1023 is in the sequence as it has digital sum 1 + 0 + 2 + 3 = 6. - _David A. Corneth_, Jun 29 2025
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..12376 (terms 1..924 from Vincenzo Librandi; all terms with <= 12 digits)
Crossrefs
Programs
-
Haskell
a052220 n = a052220_list !! (n-1) a052220_list = filter ((== 6) . a007953) [0..] -- Reinhard Zumkeller, Jul 17 2014
-
Magma
[n: n in [1..1500] | &+Intseq(n) eq 6 ]; // Vincenzo Librandi, Mar 07 2013
-
Mathematica
Select[Range[10^4], Total[IntegerDigits[#]] == 6 &] (* Vincenzo Librandi, Mar 07 2013 *)
-
PARI
nxt(n) = {my(v, c, toadd); v = valuation(n, 10); c = (n / 10^v)%10; toadd = 10^(v)*(10 - c) + c - 1; return(n + toadd)} \\ David A. Corneth, Jun 29 2025
-
Python
from sympy.utilities.iterables import multiset_permutations def auptodigs(maxdigits): alst = [] for d in range(1, maxdigits+1): digset = "0"*(d-1) + "11111122233456" for p in multiset_permutations(digset, d): if p[0] != '0' and sum(map(int, p)) == 6: alst.append(int("".join(p))) return alst print(auptodigs(4)) # Michael S. Branicky, Jun 15 2021
Formula
a(n) = a(n-1) + 10^v * (10 - c) + c-1 where c is the last nonzero digit of a(n) and v is the 10-adic valuation of a(n-1) and n > 1. - David A. Corneth, Jun 29 2025
Extensions
Offset changed by Bruno Berselli, Mar 07 2013
Comments