[go: up one dir, main page]

login
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
OFFSET
1,1
COMMENTS
A007953(a(n)) = 7; number of repdigits = #{7,1111111} = A242627(7) = 2. - Reinhard Zumkeller, Jul 17 2014
LINKS
MATHEMATICA
Select[Range[1500], Total[IntegerDigits[#]]==7&] (* Harvey P. Dale, Apr 11 2012 *)
PROG
(Magma) [n: n in [1..1500] | &+Intseq(n) eq 7 ]; // Vincenzo Librandi, Mar 08 2013
(Haskell)
a052221 n = a052221_list !! (n-1)
a052221_list = filter ((== 7) . a007953) [0..]
-- Reinhard Zumkeller, Jul 17 2014
(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
CROSSREFS
Supersequence of A119461.
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).
Sequence in context: A043481 A217009 A017245 * A119461 A326664 A028560
KEYWORD
nonn,base,easy
AUTHOR
Henry Bottomley, Feb 01 2000
EXTENSIONS
Offset changed from Bruno Berselli, Mar 07 2013
STATUS
approved