login
Composite numbers whose sum of digits is not composite.
0

%I #42 Dec 11 2023 10:50:30

%S 10,12,14,16,20,21,25,30,32,34,38,49,50,52,56,58,65,70,74,76,85,92,94,

%T 98,100,102,104,106,110,111,115,119,120,122,124,128,133,140,142,146,

%U 148,155,160,164,166,175,182,184,188,200,201,203,205,209,210,212,214,218,221,230

%N Composite numbers whose sum of digits is not composite.

%t Select[Rest@ Complement[#, Prime@ Range@ PrimePi@ Max@ #] &@ Range@ 230, ! CompositeQ@ Total@ IntegerDigits@ # &] (* _Michael De Vlieger_, Nov 15 2019 *)

%t Select[Range[250],CompositeQ[#]&&!CompositeQ[Total[IntegerDigits[#]]]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Jun 19 2021 *)

%o (PARI) lista(nn) = forcomposite(c=1, nn, my(s=sumdigits(c)); if ((s==1) || isprime(s), print1(c, ", "))); \\ _Michel Marcus_, Nov 15 2019

%o (Magma) [k:k in [2..230]| not IsPrime(k) and (IsPrime(&+Intseq(k)) or &+Intseq(k) eq 1) ]; // _Marius A. Burtea_, Feb 05 2020

%Y Cf. A046704, A104213, A141642, A228019.

%K nonn,base,easy

%O 1,1

%A _Ali Adams_, Nov 15 2019