OFFSET
1,1
COMMENTS
For each prime p there are infinitely many terms with sum of digits p. - Robert Israel, Feb 26 2017
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
filter:= proc(n) local s;
s:= convert(convert(n, base, 10), `+`);
isprime(s) and (n mod s = 0)
end proc:
select(filter, [$10..10^4]); # Robert Israel, Feb 26 2017
MATHEMATICA
Select[Range[0, 2000], With[{s = DigitSum[#]}, s < # && Divisible[#, s] && PrimeQ[s]] &] (* Paolo Xausa, May 18 2024 *)
PROG
(Python)
from sympy import isprime
def ok(n):
sd = sum(map(int, str(n)))
return 1 < sd < n and n%sd == 0 and isprime(sd)
print([k for k in range(1102) if ok(k)]) # Michael S. Branicky, Dec 20 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Patrick De Geest, Nov 15 1999
STATUS
approved