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
Donovan Johnson, Table of n, a(n) for n = 1..10000
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
KEYWORD
AUTHOR
STATUS
approved