The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A330210 Numbers that can be expressed as the sum of 2 prime numbers in a prime number of different ways. 0

%I #12 Dec 07 2019 00:50:13

%S 10,14,16,18,20,22,24,26,28,30,32,38,40,44,48,52,54,56,62,64,68,70,74,

%T 76,78,82,86,94,96,98,104,112,124,128,130,136,140,144,148,156,158,164,

%U 168,174,176,178,186,188,192,194,198,206,208,210,216,218,222,224

%N Numbers that can be expressed as the sum of 2 prime numbers in a prime number of different ways.

%e 24 can be expressed as the sum of 2 prime numbers in 3 different ways (5+19, 7+17, and 11+13), and 3 is prime.

%t Select[Range[2, 224, 2], PrimeQ@ Length@ IntegerPartitions[#, {2}, Prime@ Range@ PrimePi@ #] &] (* _Giovanni Resta_, Dec 06 2019 *)

%o (Python 3)

%o import math

%o from sympy import isprime

%o def main(n):

%o x = {}

%o a = 1

%o b = 1

%o for i in range(2, n):

%o x[i] = []

%o while a < i:

%o if a + b == i:

%o x[i].append(str(a) + "+" + str(b))

%o b += 1

%o if b == i:

%o a += 1

%o b = 1

%o a = 1

%o b = 1

%o for i in x:

%o x[i] = x[i][0:math.ceil(len(x[i])/2)]

%o x[2] = ["1+1"]

%o newdict = {}

%o for i in x:

%o newdict[i] = []

%o for j in x[i]:

%o if isprime(int(j.split("+")[0])) and isprime(int(j.split("+")[1])):

%o newdict[i].append(j)

%o finaloutput = []

%o for i in newdict:

%o if isprime(len(newdict[i])):

%o finaloutput.append(i)

%o return finaloutput

%o def a(n):

%o x = 0

%o while len(main(x)) != n:

%o x += 1

%o return main(x)[-1]

%Y Cf. A000040, A014091, A061358.

%K nonn

%O 1,1

%A _Pietro Saia_, Dec 05 2019

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 June 3 05:44 EDT 2024. Contains 373054 sequences. (Running on oeis4.)