A052221 Numbers whose sum of digits is 7.
7, 16, 25, 34, 43, 52, 61, 70, 106, 115, 124, 133, 142, 151, 160, 205, 214, 223, 232, 241, 250, 304, 313, 322, 331, 340, 403, 412, 421, 430, 502, 511, 520, 601, 610, 700, 1006, 1015, 1024, 1033, 1042, 1051, 1060, 1105, 1114, 1123, 1132, 1141, 1150, 1204
Offset: 1
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Crossrefs
Supersequence of A119461.
Programs
-
Haskell
a052221 n = a052221_list !! (n-1) a052221_list = filter ((== 7) . a007953) [0..] -- Reinhard Zumkeller, Jul 17 2014
-
Magma
[n: n in [1..1500] | &+Intseq(n) eq 7 ]; // Vincenzo Librandi, Mar 08 2013
-
Mathematica
Select[Range[1500],Total[IntegerDigits[#]]==7&] (* Harvey P. Dale, Apr 11 2012 *)
-
Python
def ok(n): return sum(map(int, str(n))) == 7 print(list(filter(ok, range(1205)))) # Michael S. Branicky, Jul 16 2021
-
Python
# faster version generating initial segment from sympy.utilities.iterables import multiset_permutations def auptodigs(maxdigits): alst = [] for d in range(1, maxdigits+1): digset = "0"*(d-1) + "1111111222334567" for p in multiset_permutations(digset, d): if p[0] != '0' and sum(map(int, p)) == 7: alst.append(int("".join(p))) return alst print(auptodigs(4)) # Michael S. Branicky, Jul 16 2021
Extensions
Offset changed from Bruno Berselli, Mar 07 2013
Comments