|
|
A052221
|
|
Numbers whose sum of digits is 7.
|
|
37
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
|
|
LINKS
|
|
|
MATHEMATICA
|
Select[Range[1500], Total[IntegerDigits[#]]==7&] (* Harvey P. Dale, Apr 11 2012 *)
|
|
PROG
|
(Haskell)
a052221 n = a052221_list !! (n-1)
a052221_list = filter ((== 7) . a007953) [0..]
(Python)
def ok(n): return sum(map(int, str(n))) == 7
(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
|
|
CROSSREFS
|
Cf. A011557 (1), A052216 (2), A052217 (3), A052218 (4), A052219 (5), A052220 (6), A052222 (8), A052223 (9), A052224 (10), A166311 (11), A235151 (12), A143164 (13), A235225(14), A235226 (15), A235227 (16), A166370 (17), A235228 (18), A166459 (19), A235229 (20).
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|