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!)
A166975 Four-digit primes such that, if the digits are ABCD, then AB+CD and A+B+C+D are also primes. 1

%I #19 Aug 20 2022 13:38:14

%S 1013,1019,1031,1033,1051,1091,1093,1097,1217,1231,1259,1277,1291,

%T 1297,1433,1439,1453,1459,1493,1499,1613,1637,1657,1693,1697,1811,

%U 1871,2003,2027,2063,2069,2081,2083,2087,2089,2207,2221,2267,2281,2287,2423,2447

%N Four-digit primes such that, if the digits are ABCD, then AB+CD and A+B+C+D are also primes.

%C The last term of this sequence is a(179) = 9859.

%C Subsequence of A046704. - _R. J. Mathar_, Oct 28 2009

%C 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

%H Nathaniel Johnston, <a href="/A166975/b166975.txt">Table of n, a(n) for n = 1..179</a> (full sequence)

%e 1217 is in the list since 1217, 12+17=29, and 1+2+1+7=11 are all primes.

%p 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

%t 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 *)

%o (Python)

%o from sympy import isprime

%o def ok(n):

%o if n < 1000 or n > 9999 or not isprime(n): return False

%o return isprime(n//100 + n%100) and isprime(sum(map(int, str(n))))

%o afull = [k for k in range(1001, 10000, 2) if ok(k)]

%o print(afull[:42]) # _Michael S. Branicky_, Aug 20 2022

%K base,easy,fini,full,nonn

%O 1,1

%A _Ray G. Opao_, Oct 26 2009

%E Numbers in the range 1000 to 1200 inserted by _R. J. Mathar_, Oct 28 2009

%E Many terms corrected by _Nathaniel Johnston_, Jun 03 2011

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 May 5 05:35 EDT 2024. Contains 372257 sequences. (Running on oeis4.)