login
Sum of digits of k is a prime proper factor of k.
7

%I #19 May 18 2024 14:45:36

%S 12,20,21,30,50,70,102,110,111,120,133,140,200,201,209,210,230,247,

%T 300,308,320,322,364,407,410,476,481,500,506,511,605,629,700,704,715,

%U 782,803,832,874,902,935,1002,1010,1011,1015,1020,1040,1066,1088,1100,1101

%N Sum of digits of k is a prime proper factor of k.

%C For each prime p there are infinitely many terms with sum of digits p. - _Robert Israel_, Feb 26 2017

%H Robert Israel, <a href="/A052020/b052020.txt">Table of n, a(n) for n = 1..10000</a>

%p filter:= proc(n) local s;

%p s:= convert(convert(n,base,10),`+`);

%p isprime(s) and (n mod s = 0)

%p end proc:

%p select(filter, [$10..10^4]); # _Robert Israel_, Feb 26 2017

%t Select[Range[0, 2000], With[{s = DigitSum[#]}, s < # && Divisible[#, s] && PrimeQ[s]] &] (* _Paolo Xausa_, May 18 2024 *)

%o (Python)

%o from sympy import isprime

%o def ok(n):

%o sd = sum(map(int, str(n)))

%o return 1 < sd < n and n%sd == 0 and isprime(sd)

%o print([k for k in range(1102) if ok(k)]) # _Michael S. Branicky_, Dec 20 2021

%Y Cf. A052018, A052019, A052021, A052022, A007953, A005349, A028834.

%K nonn,base,easy

%O 1,1

%A _Patrick De Geest_, Nov 15 1999