OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
a(12)=915 because it has a digital sum of 15, is divisible by 15 and ends in 15.
MATHEMATICA
hndsQ[n_]:=Module[{ds=Total[IntegerDigits[n]]}, Divisible[n, ds] && Mod[ n, 10^IntegerLength[ds]]==ds]; Select[Range[10000], hndsQ] (* Harvey P. Dale, Dec 24 2011 *)
PROG
(Python)
def ok(n):
s = str(n)
d = sum(map(int, s))
return d and n%d == 0 and s.endswith(str(d))
print([k for k in range(10**4) if ok(k)]) # Michael S. Branicky, Jun 10 2024
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Jason Earls, May 12 2002
STATUS
approved