[go: up one dir, main page]

login
A166975
Four-digit primes such that, if the digits are ABCD, then AB+CD and A+B+C+D are also primes.
1
1013, 1019, 1031, 1033, 1051, 1091, 1093, 1097, 1217, 1231, 1259, 1277, 1291, 1297, 1433, 1439, 1453, 1459, 1493, 1499, 1613, 1637, 1657, 1693, 1697, 1811, 1871, 2003, 2027, 2063, 2069, 2081, 2083, 2087, 2089, 2207, 2221, 2267, 2281, 2287, 2423, 2447
OFFSET
1,1
COMMENTS
The last term of this sequence is a(179) = 9859.
Subsequence of A046704. - R. J. Mathar, Oct 28 2009
Prime digit sums 5, 7, 11, 13, 17, 19, 23, 29, 31 occur 5, 8, 23, 19, 37, 37, 38, 9, 3 times, respectively. Sequence contains ten twin prime pairs. - Rick L. Shepherd, Feb 19 2013
LINKS
Nathaniel Johnston, Table of n, a(n) for n = 1..179 (full sequence)
EXAMPLE
1217 is in the list since 1217, 12+17=29, and 1+2+1+7=11 are all primes.
MAPLE
p:=1009: while p<10000 do d:=convert(p, base, 10): if(isprime(add(d[j], j=1..4)) and isprime(d[1]+d[3]+10*(d[2]+d[4])))then printf("%d, ", p): fi: p:=nextprime(p): od: # Nathaniel Johnston, Jun 03 2011
MATHEMATICA
apQ[n_]:=Module[{idn=IntegerDigits[n], a, b, c, d}, a=idn[[1]]; b=idn[[2]]; c= idn[[3]]; d=idn[[4]]; AllTrue[{10a+b+10c+d, Total[idn]}, PrimeQ]]; Select[ Prime[Range[PrimePi[1000]+1, PrimePi[9999]]], apQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Mar 14 2015 *)
PROG
(Python)
from sympy import isprime
def ok(n):
if n < 1000 or n > 9999 or not isprime(n): return False
return isprime(n//100 + n%100) and isprime(sum(map(int, str(n))))
afull = [k for k in range(1001, 10000, 2) if ok(k)]
print(afull[:42]) # Michael S. Branicky, Aug 20 2022
CROSSREFS
Sequence in context: A107518 A073144 A131461 * A266369 A165295 A069489
KEYWORD
base,easy,fini,full,nonn
AUTHOR
Ray G. Opao, Oct 26 2009
EXTENSIONS
Numbers in the range 1000 to 1200 inserted by R. J. Mathar, Oct 28 2009
Many terms corrected by Nathaniel Johnston, Jun 03 2011
STATUS
approved