OFFSET
1,2
COMMENTS
Partition the set Pn = {2,3,5,...,pn} of the first n primes into two disjoint parts. Let a,b be their respective products, S = a + b and D = |a - b|. The list is composed of sorted values of S and D.
Numbers a,b share no common factors. It follows that the prime factors of S or D can't divide either a or b. So the smallest possible prime factor of S or D is pn+1.
After the value 1, the next 25 numbers of the list are primes. Then the proportion of primes decreases. For the first 2000 elements, about 50% are primes.
LINKS
C. Aebi and G. Cairns, Partitions of Primes, Parabola, Vol. 45, No. 1 (2009).
EXAMPLE
3 - 2 = 1
2 + 3 = 5
2*5 - 3 = 7
2*3 + 5 = 11
2*5 + 3 = 13
3*5 + 2 = 17
2*3*5 - 7 = 23
2*7 + 3*5 = 29
2*5 + 3*7 = 31
...
PROG
(JavaScript)
<script>
/**************************
Sum and Difference of multiplication of two complementary subset the n first primes
****************************/
// List of the first primes
var P=new Array(2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97);
function Sum_and_Difference(n)
{
var L=[]; // Table used to have the two partitions of a set of elements
var a=1; // First product of primes
var b=1; // Second product of primes
var Ok = 0; // if n is only composed of 1
var S, D; // Sum and Difference of products of primes
// Generate a table L containing n in binary digits : 0 and 1 values in L are used to obtain the two partitions
do
{
var r=n%2;
L.push(r);
n=(n-r)/2;
}while(n!=0);
for(var i=0; i < L.length ; i++)
{
if(L[i] == 0)
{
Ok = 1;
a = a * P[i];
}
else
b = b * P[i];
}
if (Ok)
{
D = Math.abs(a-b);
document.write(D + " = |" + a + " - " + b + "| </BR> ");
S = a+b;
document.write(S + " = " + a + " + " + b + " </BR> ");
}
}
for (var j = 1 ; j < 32 ; j++)
{
Sum_and_Difference(j);
}
</script>
CROSSREFS
KEYWORD
nonn
AUTHOR
Yves Debeuret, Aug 04 2017
STATUS
approved