Possible method to prove infinite twin prime conjecture
Wolfram Language code to test whether does $p$ provide the twin prime number pair via your conjecture or not is as follows.
twinPrimesQ[tp_]:=tp[[1]]+2==tp[[2]]&&PrimeQ[tp[[1]]]&&PrimeQ[tp[[2]]];
primesList[p_]:=Module[{out={Prime[3]},i},
For[i=4,Prime[i]<=p,i=i+1,
out=Append[out,Prime[i]];
];
out
];
testPrime[p_,pl_]:=Module[{out,found=False,twinPrimes,primeFactors,primeFactorsPowers,i},
twinPrimes={
{3 5 prod p-4,3 5 prod p-2},
{3 5 prod p+2,3 5 prod p+4}
};
primeFactors=primesList[p];
primeFactorsPowers=Tuples[Range[0,pl],primeFactors//Length];
For[i=1,i<=Length[primeFactorsPowers],i=i+1,
out=twinPrimes/.prod->Product[primeFactors[[k]]^primeFactorsPowers[[i]][[k]],{k,1,primeFactors//Length}];
found=twinPrimesQ[out[[1]]]||twinPrimesQ[out[[2]]];
If[found,Break[]];
];
If[found,out~Select~(twinPrimesQ[#]&)//First,False]
];
This defines a function twinPrime[p,pl]
where p
=$\,p$ and pl
is the maximum power of prime factors of $P_p$ to search upon. The function returns the first found twin pair or False
if it has failed.
For example:
You can try this online with Mathics.
To confirm or disprove your conjecture for ranges of primes, you can use
out=List[]; For[i=4,i<=7,i=i+1,out=out~Append~{i,Prime[i],testPrime[Prime[i],1]}]; out//TableForm
adjusting the bounds of search (values of j
in terms of consecutive number of primes) and maximum power of prime factors. This will output a table with three columns: the id of the prime being tested, the prime itself and the first twin prime pair found (or False
if none).