OFFSET
1,1
COMMENTS
p[n] will always be 2 and s[n] and s[n]+p[n] will always be twin primes.
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
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
A. G. Gevisier, A curiosity about the number 12
MATHEMATICA
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} ]
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 *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Santi Spadaro, Nov 17 2001
EXTENSIONS
Comment and more terms from Larry Reeves (larryr(AT)acm.org), Nov 27 2001
STATUS
approved