|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
|
|
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
(Python)
from itertools import count, combinations_with_replacement
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:
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|