OFFSET
1,1
COMMENTS
This sequence is inspired by a problem, proposed by Argentina during the 39th International Mathematical Olympiad in 1998 at Taipei, Taiwan, but not used for the competition.
The problem asked for a proof that, for each positive integer n, there exists a n-digit number, not containing the digit 0 and that is divisible by the sum of its digits (see links: Diophante in French and Kalva in English).
This sequence lists the largest such n-digit integer.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..1000
Diophante, Bon souvenir de Buenos-Aires.
EXAMPLE
9963 has 4 digits, does not contain 0 and is divisible by 9+9+6+3 = 27 (9963 = 27*369), while there is no integer k with 9964 <= k <= 9999 that is divisible by sum of its digits, hence a(4) = 9963.
MATHEMATICA
hQ[n_] := ! MemberQ[(d = IntegerDigits[n]), 0] && Divisible[n, Plus @@ d]; a[n_] := Module[{k = 10^n}, While[! hQ[k], k--]; k]; Array[a, 20] (* Amiram Eldar, Oct 11 2021 *)
PROG
(Python)
def a(n):
s, k = "9"*n, int("9"*n)
while '0' in s or k%sum(map(int, s)): k -= 1; s = str(k)
return k
print([a(n) for n in range(1, 22)]) # Michael S. Branicky, Oct 11 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Oct 11 2021
EXTENSIONS
More terms from Amiram Eldar, Oct 11 2021
STATUS
approved