%I #13 Apr 03 2023 10:36:10
%S 12,21,1112,1121,1211,2111,1111111112,1111111121,1111111211,
%T 1111112111,1111121111,1111211111,1112111111,1121111111,1211111111,
%U 2111111111,1111111111111112,1111111111111121,1111111111111211,1111111111112111
%N Numbers n such that s[n], p[n] and s[n]+p[n] are all prime numbers, where s[n] is the sum of digits of n and p[n] is the product of digits of n.
%C p[n] will always be 2 and s[n] and s[n]+p[n] will always be twin primes.
%C It is therefore hugely more efficient to search for terms by looking at permutations of any given number of ones together with one two. In addition, it is more efficient not to compute or consider permutations of two together with 4, 7, 10, . . . 3n+1 ones because the sums of those digits are all multiples of 3 so the numbers cannot be primes. - _Harvey P. Dale_, Apr 27 2019
%H Harvey P. Dale, <a href="/A065439/b065439.txt">Table of n, a(n) for n = 1..1000</a>
%H A. G. Gevisier, <a href="https://t5k.org/curios/ByOne.php?submitter=Gevisier">A curiosity about the number 12</a>
%t Do[s = Apply[ Plus, IntegerDigits[n]]; p = Apply[ Times, IntegerDigits[n]]; If[ PrimeQ[s] && PrimeQ[p] && PrimeQ[s + p], Print[n]], {n, 1, 10^7} ]
%t spQ[n_]:=Module[{idn=IntegerDigits[n],s,p},s=Total[idn];p=Times@@idn;AllTrue[ {s,p,s+p},PrimeQ]]; Table[Select[FromDigits/@Permutations[ Join[ {2},PadRight[{},n,1]]],spQ],{n,Drop[Range[200],{0,-1,3}]}]//Flatten//Sort (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Apr 27 2019 *)
%K base,nonn
%O 1,1
%A _Santi Spadaro_, Nov 17 2001
%E Comment and more terms from Larry Reeves (larryr(AT)acm.org), Nov 27 2001
|