OFFSET
1,1
COMMENTS
This sequence is infinite because all numbers with a digitsum equal to 9 are part of this sequence.
LINKS
Pieter Post, Table of n, a(n) for n = 1..12089
EXAMPLE
a(1) = 5, because 5 divided by (10 - 5) equals 1.
a(7) = 26, because digitsum(26) = 8 and 26 divided by (10 - 8) equals 13.
a(20) = 86, the first member of this sequence where digitsum(n) >= 10. Digitsum(86) = 14, so k = 10^2 - 14 = 86, so 86 is a member of this sequence.
MATHEMATICA
fQ[n_] := Block[{d = Total@ IntegerDigits@ n, k}, k = IntegerLength@ d;
Divisible[n, 10^k - d]]; Select[Range@ 314, fQ] (* or *)
Select[Range@ 314, Divisible[#, (10^(Floor[Log[10, Total@ IntegerDigits@ #]] + 1) - Total@ IntegerDigits@ #)] &] (* Michael De Vlieger, Aug 05 2015 *)
PROG
(Python)
def sod(n, m):
....kk = 0
....while n > 0:
........kk= kk+(n%m)
........n =int(n//m)
....return kk
for c in range (1, 10**6):
....k=len(str(sod(c, 10)))
....kl=10**k-sod(c, 10)
....if c%kl==0:
........print (c)
(PARI) isok(n)=my(sd = sumdigits(n), nsd = #digits(sd)); n % (10^nsd - sd) == 0; \\ Michel Marcus, Aug 05 2015
CROSSREFS
KEYWORD
nonn,base,less
AUTHOR
Pieter Post, Jul 23 2015
STATUS
approved