OFFSET
1,1
COMMENTS
A007953(a(n)) = 7; number of repdigits = #{7,1111111} = A242627(7) = 2. - Reinhard Zumkeller, Jul 17 2014
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
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
KEYWORD
nonn,base,easy
AUTHOR
Henry Bottomley, Feb 01 2000
EXTENSIONS
Offset changed from Bruno Berselli, Mar 07 2013
STATUS
approved