[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
login
A003634
Smallest positive integer that is n times its digit sum, or 0 if no such number exists.
(Formerly M5054)
12
1, 18, 27, 12, 45, 54, 21, 72, 81, 10, 198, 108, 117, 126, 135, 144, 153, 162, 114, 180, 378, 132, 207, 216, 150, 234, 243, 112, 261, 270, 372, 576, 594, 102, 315, 324, 111, 342, 351, 120, 738, 756, 516, 792, 405, 230, 423, 432, 441, 450, 918, 312, 954, 972
OFFSET
1,2
COMMENTS
a(n) = 0 for n = 62, 63, 65, ... (A003635). - Robert G. Wilson v, Aug 15 2000
REFERENCES
J. H. Conway, personal communication.
Anthony Gardiner, Mathematical Puzzling, Dover Publications, Inc., Mineola, NY, 1987, Page 11.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
EXAMPLE
a(3) = 27 because no number less than 27 has a digit sum equal to 3 times the number.
MATHEMATICA
Do[k = n; While[Apply[Plus, RealDigits[k][[1]]]*n != k, k += n]; Print[k], {n, 1, 61}]
With[{ll=Select[Table[{n, n/Total[IntegerDigits[n]]}, {n, 1000}], IntegerQ[ #[[2]]]&]}, Table[Select[ll, #[[2]]==i&, 1][[1, 1]], {i, 60}]] (* Harvey P. Dale, Mar 09 2012 *)
PROG
(Python)
def sd(n): return sum(map(int, str(n)))
def a(n):
m = 1
while m != n*sd(m): m += 1
return m
print([a(n) for n in range(1, 62)]) # Michael S. Branicky, Jan 18 2021
(Python)
from itertools import count, combinations_with_replacement
def A003634(n):
for l in count(1):
if 9*l*n < 10**(l-1): return 0
c = 10**l
for d in combinations_with_replacement(range(10), l):
if sorted(str(a:=sum(d)*n)) == [str(e) for e in d] and a>0:
c = min(c, a)
if c < 10**l:
return c # Chai Wah Wu, May 09 2023
CROSSREFS
Sequence in context: A337523 A167336 A328687 * A338383 A338385 A220100
KEYWORD
nonn,base,easy,look,nice
STATUS
approved