login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A227217 Primes p such that p + (product of digits of p) is prime and p - (product of digits of p) is prime. 3
23, 29, 83, 101, 103, 107, 109, 293, 307, 347, 349, 401, 409, 431, 439, 503, 509, 601, 607, 653, 659, 677, 701, 709, 743, 809, 907, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1123, 1201, 1297, 1301, 1303, 1307, 1409, 1423, 1489, 1523 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Intersection of A157677 and A225319.
Contains A056709. - Robert Israel, Apr 13 2015
LINKS
EXAMPLE
431 is prime, 431 + (4*3*1) = 443 is prime, and 431 - (4*3*1) = 419 is prime. So, 431 is a term in the sequence.
MAPLE
filter:= proc(n) local m;
if not isprime(n) then return false fi;
m:= convert(convert(n, base, 10), `*`);
if m = 0 then return true fi;
isprime(n+m) and isprime(n-m)
end proc:
select(filter, [seq(2*i+1, i=5..10000)]); # Robert Israel, Apr 13 2015
MATHEMATICA
fQ[n_] := Block[{d = IntegerDigits@ n}, PrimeQ[n + Times @@ d] && PrimeQ[n - Times @@ d]]; Select[Prime@ Range@ 250, fQ] (* Michael De Vlieger, Apr 12 2015 *)
PROG
(Python)
from sympy import isprime, primerange
def DP(n):
p = 1
for i in str(n):
p *= int(i)
return p
for pn in primerange(1, 2000):
dpn = DP(pn)
if isprime(pn-dpn) and isprime(pn+dpn):
print(pn, end=', ')
# Simplified by Derek Orr, Apr 10 2015
(Sage)
[p for p in primes_first_n(1000) if ((p-prod(Integer(p).digits(base=10))) in Primes() and (p+prod(Integer(p).digits(base=10))) in Primes())] # Tom Edgar, Sep 19 2013
(PARI) forprime(p=1, 2000, d=digits(p); P=prod(i=1, #d, d[i]); if(isprime(p+P)&&isprime(p-P), print1(p, ", "))) \\ Derek Orr, Apr 10 2015
CROSSREFS
Sequence in context: A110584 A115396 A180538 * A229176 A232726 A029541
KEYWORD
nonn,base
AUTHOR
Derek Orr, Sep 19 2013
EXTENSIONS
More terms from Derek Orr, Apr 10 2015
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 16:22 EDT 2024. Contains 371780 sequences. (Running on oeis4.)