Twin primes whose sum is a cube [on hold]$84537841287167$ and $84537841287169$ a particular pair of twin primes!Conjecture on twin primesAbout a paper by Gold & Tucker (characterizing twin primes)Twin Primes Problem: Need HelpNumber Theory : Primes not in Twin PrimesIs there more than one occurrence of a power of two between twin primes?Twin Primes, their Arithmetic Means and some properties.Twin Primes and Complete Residue SystemsWhat is wrong with this reasoning regarding twin primes?A sieve for twin primes; does it imply there are infinite many twin primes?A twin prime theorem, and a reformulation of the twin prime conjecture

How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?

Draw simple lines in Inkscape

Work Breakdown with Tikz

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

How can I hide my bitcoin transactions to protect anonymity from others?

Should I join office cleaning event for free?

I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine

Copenhagen passport control - US citizen

I see my dog run

Why is this code 6.5x slower with optimizations enabled?

How to make payment on the internet without leaving a money trail?

How to report a triplet of septets in NMR tabulation?

Is it possible to do 50 km distance without any previous training?

Why are 150k or 200k jobs considered good when there are 300k+ births a month?

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

Validation accuracy vs Testing accuracy

How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?

Motorized valve interfering with button?

Is there a familial term for apples and pears?

How do I create uniquely male characters?

Do Phineas and Ferb ever actually get busted in real time?

What would the Romans have called "sorcery"?

DOS, create pipe for stdin/stdout of command.com(or 4dos.com) in C or Batch?

Do airline pilots ever risk not hearing communication directed to them specifically, from traffic controllers?



Twin primes whose sum is a cube [on hold]


$84537841287167$ and $84537841287169$ a particular pair of twin primes!Conjecture on twin primesAbout a paper by Gold & Tucker (characterizing twin primes)Twin Primes Problem: Need HelpNumber Theory : Primes not in Twin PrimesIs there more than one occurrence of a power of two between twin primes?Twin Primes, their Arithmetic Means and some properties.Twin Primes and Complete Residue SystemsWhat is wrong with this reasoning regarding twin primes?A sieve for twin primes; does it imply there are infinite many twin primes?A twin prime theorem, and a reformulation of the twin prime conjecture













7












$begingroup$


$84537841287167$ and $84537841287169$ are a pair of twin primes.



The sum of $84537841287167+84537841287169$ is a cube.



Are there other examples of twin pairs $p$, $p+2$ whose sum is a cube?



Have they to have a particular form?










share|cite|improve this question









New contributor




pantareis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$



put on hold as off-topic by user21820, Adrian Keister, Saad, José Carlos Santos, YiFan 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is missing context or other details: Please provide additional context, which ideally explains why the question is relevant to you and our community. Some forms of context include: background and motivation, relevant definitions, source, possible strategies, your current progress, why the question is interesting or important, etc." – user21820, Adrian Keister, Saad, José Carlos Santos, YiFan
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1




    $begingroup$
    What do you want to do with other examples?
    $endgroup$
    – Dietrich Burde
    Apr 4 at 9:50






  • 6




    $begingroup$
    For $k le 10000$, there are $185$ values of $k$ where $p = 108k^3-1$ and $p+2$ are twin primes that sum to a cube. Following are some examples.. $107,2634011,29659499,57395627,104792291,271669247,485149499,cdots\ 83797007573051, colorred84537841287167, 88875400155587,89731703685707,89846291353499,cdots$
    $endgroup$
    – achille hui
    Apr 4 at 10:23






  • 1




    $begingroup$
    @taritgoswami it is a single line command using the CAS maxima for k : 1 thru 10000 do if (primep(108*k^3-1) and primep(108*k^3+1)) then print(k," ",108*k^3-1);
    $endgroup$
    – achille hui
    Apr 4 at 12:10






  • 3




    $begingroup$
    oeis.org/A061308 is worth a look.
    $endgroup$
    – Barry Cipra
    Apr 4 at 12:15






  • 2




    $begingroup$
    similarly oeis.org/A240169
    $endgroup$
    – KBusc
    Apr 4 at 16:00















7












$begingroup$


$84537841287167$ and $84537841287169$ are a pair of twin primes.



The sum of $84537841287167+84537841287169$ is a cube.



Are there other examples of twin pairs $p$, $p+2$ whose sum is a cube?



Have they to have a particular form?










share|cite|improve this question









New contributor




pantareis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$



put on hold as off-topic by user21820, Adrian Keister, Saad, José Carlos Santos, YiFan 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is missing context or other details: Please provide additional context, which ideally explains why the question is relevant to you and our community. Some forms of context include: background and motivation, relevant definitions, source, possible strategies, your current progress, why the question is interesting or important, etc." – user21820, Adrian Keister, Saad, José Carlos Santos, YiFan
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1




    $begingroup$
    What do you want to do with other examples?
    $endgroup$
    – Dietrich Burde
    Apr 4 at 9:50






  • 6




    $begingroup$
    For $k le 10000$, there are $185$ values of $k$ where $p = 108k^3-1$ and $p+2$ are twin primes that sum to a cube. Following are some examples.. $107,2634011,29659499,57395627,104792291,271669247,485149499,cdots\ 83797007573051, colorred84537841287167, 88875400155587,89731703685707,89846291353499,cdots$
    $endgroup$
    – achille hui
    Apr 4 at 10:23






  • 1




    $begingroup$
    @taritgoswami it is a single line command using the CAS maxima for k : 1 thru 10000 do if (primep(108*k^3-1) and primep(108*k^3+1)) then print(k," ",108*k^3-1);
    $endgroup$
    – achille hui
    Apr 4 at 12:10






  • 3




    $begingroup$
    oeis.org/A061308 is worth a look.
    $endgroup$
    – Barry Cipra
    Apr 4 at 12:15






  • 2




    $begingroup$
    similarly oeis.org/A240169
    $endgroup$
    – KBusc
    Apr 4 at 16:00













7












7








7


2



$begingroup$


$84537841287167$ and $84537841287169$ are a pair of twin primes.



The sum of $84537841287167+84537841287169$ is a cube.



Are there other examples of twin pairs $p$, $p+2$ whose sum is a cube?



Have they to have a particular form?










share|cite|improve this question









New contributor




pantareis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




$84537841287167$ and $84537841287169$ are a pair of twin primes.



The sum of $84537841287167+84537841287169$ is a cube.



Are there other examples of twin pairs $p$, $p+2$ whose sum is a cube?



Have they to have a particular form?







elementary-number-theory






share|cite|improve this question









New contributor




pantareis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|cite|improve this question









New contributor




pantareis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|cite|improve this question




share|cite|improve this question








edited Apr 4 at 10:11









tarit goswami

2,1201422




2,1201422






New contributor




pantareis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 4 at 9:29









pantareispantareis

597




597




New contributor




pantareis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





pantareis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






pantareis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as off-topic by user21820, Adrian Keister, Saad, José Carlos Santos, YiFan 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is missing context or other details: Please provide additional context, which ideally explains why the question is relevant to you and our community. Some forms of context include: background and motivation, relevant definitions, source, possible strategies, your current progress, why the question is interesting or important, etc." – user21820, Adrian Keister, Saad, José Carlos Santos, YiFan
If this question can be reworded to fit the rules in the help center, please edit the question.







put on hold as off-topic by user21820, Adrian Keister, Saad, José Carlos Santos, YiFan 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is missing context or other details: Please provide additional context, which ideally explains why the question is relevant to you and our community. Some forms of context include: background and motivation, relevant definitions, source, possible strategies, your current progress, why the question is interesting or important, etc." – user21820, Adrian Keister, Saad, José Carlos Santos, YiFan
If this question can be reworded to fit the rules in the help center, please edit the question.







  • 1




    $begingroup$
    What do you want to do with other examples?
    $endgroup$
    – Dietrich Burde
    Apr 4 at 9:50






  • 6




    $begingroup$
    For $k le 10000$, there are $185$ values of $k$ where $p = 108k^3-1$ and $p+2$ are twin primes that sum to a cube. Following are some examples.. $107,2634011,29659499,57395627,104792291,271669247,485149499,cdots\ 83797007573051, colorred84537841287167, 88875400155587,89731703685707,89846291353499,cdots$
    $endgroup$
    – achille hui
    Apr 4 at 10:23






  • 1




    $begingroup$
    @taritgoswami it is a single line command using the CAS maxima for k : 1 thru 10000 do if (primep(108*k^3-1) and primep(108*k^3+1)) then print(k," ",108*k^3-1);
    $endgroup$
    – achille hui
    Apr 4 at 12:10






  • 3




    $begingroup$
    oeis.org/A061308 is worth a look.
    $endgroup$
    – Barry Cipra
    Apr 4 at 12:15






  • 2




    $begingroup$
    similarly oeis.org/A240169
    $endgroup$
    – KBusc
    Apr 4 at 16:00












  • 1




    $begingroup$
    What do you want to do with other examples?
    $endgroup$
    – Dietrich Burde
    Apr 4 at 9:50






  • 6




    $begingroup$
    For $k le 10000$, there are $185$ values of $k$ where $p = 108k^3-1$ and $p+2$ are twin primes that sum to a cube. Following are some examples.. $107,2634011,29659499,57395627,104792291,271669247,485149499,cdots\ 83797007573051, colorred84537841287167, 88875400155587,89731703685707,89846291353499,cdots$
    $endgroup$
    – achille hui
    Apr 4 at 10:23






  • 1




    $begingroup$
    @taritgoswami it is a single line command using the CAS maxima for k : 1 thru 10000 do if (primep(108*k^3-1) and primep(108*k^3+1)) then print(k," ",108*k^3-1);
    $endgroup$
    – achille hui
    Apr 4 at 12:10






  • 3




    $begingroup$
    oeis.org/A061308 is worth a look.
    $endgroup$
    – Barry Cipra
    Apr 4 at 12:15






  • 2




    $begingroup$
    similarly oeis.org/A240169
    $endgroup$
    – KBusc
    Apr 4 at 16:00







1




1




$begingroup$
What do you want to do with other examples?
$endgroup$
– Dietrich Burde
Apr 4 at 9:50




$begingroup$
What do you want to do with other examples?
$endgroup$
– Dietrich Burde
Apr 4 at 9:50




6




6




$begingroup$
For $k le 10000$, there are $185$ values of $k$ where $p = 108k^3-1$ and $p+2$ are twin primes that sum to a cube. Following are some examples.. $107,2634011,29659499,57395627,104792291,271669247,485149499,cdots\ 83797007573051, colorred84537841287167, 88875400155587,89731703685707,89846291353499,cdots$
$endgroup$
– achille hui
Apr 4 at 10:23




$begingroup$
For $k le 10000$, there are $185$ values of $k$ where $p = 108k^3-1$ and $p+2$ are twin primes that sum to a cube. Following are some examples.. $107,2634011,29659499,57395627,104792291,271669247,485149499,cdots\ 83797007573051, colorred84537841287167, 88875400155587,89731703685707,89846291353499,cdots$
$endgroup$
– achille hui
Apr 4 at 10:23




1




1




$begingroup$
@taritgoswami it is a single line command using the CAS maxima for k : 1 thru 10000 do if (primep(108*k^3-1) and primep(108*k^3+1)) then print(k," ",108*k^3-1);
$endgroup$
– achille hui
Apr 4 at 12:10




$begingroup$
@taritgoswami it is a single line command using the CAS maxima for k : 1 thru 10000 do if (primep(108*k^3-1) and primep(108*k^3+1)) then print(k," ",108*k^3-1);
$endgroup$
– achille hui
Apr 4 at 12:10




3




3




$begingroup$
oeis.org/A061308 is worth a look.
$endgroup$
– Barry Cipra
Apr 4 at 12:15




$begingroup$
oeis.org/A061308 is worth a look.
$endgroup$
– Barry Cipra
Apr 4 at 12:15




2




2




$begingroup$
similarly oeis.org/A240169
$endgroup$
– KBusc
Apr 4 at 16:00




$begingroup$
similarly oeis.org/A240169
$endgroup$
– KBusc
Apr 4 at 16:00










5 Answers
5






active

oldest

votes


















20












$begingroup$

List of Some Twin Primes Greater than $bf3$ whose Sum is a Cube



The sum of twin primes $6k-1$ and $6k+1$ is $12k$ and $12k=j^3implies6mid j$. So to look for such twin primes, look for twin primes of the form
$$
(108n^3-1,108n^3+1)
$$

We can skip $nequiv2pmod5$ since
$$
beginalign
108cdot n^3+1
&equiv3cdot2^3+1&pmod5\
&equiv0&pmod5
endalign
$$

and we can skip $nequiv3pmod5$ since
$$
beginalign
108cdot n^3-1
&equiv3cdot3^3-1&pmod5\
&equiv0&pmod5
endalign
$$

Checking $nequiv0,1,4pmod5$, we get
$$
beginarrayl
n&108n^3-1&108n^3+1\hline
1&107&109\
29&2634011&2634013\
65&29659499&29659501\
81&57395627&57395629\
99&104792291&104792293\
136&271669247&271669249\
165&485149499&485149501\
174&568946591&568946593\
176&588791807&588791809\
191&752530067&752530069\
200&863999999&864000001\
266&2032678367&2032678369\
295&2772616499&2772616501\
301&2945257307&2945257309\
319&3505869971&3505869973\
346&4473547487&4473547489\
351&4670303507&4670303509\
370&5470523999&5470524001\
400&6911999999&6912000001\
411&7498065347&7498065349\
431&8646803027&8646803029\
434&8828622431&8828622433\
436&8951240447&8951240449\
456&10240432127&10240432129\
491&12784043267&12784043269\
494&13019808671&13019808673\
526&15717410207&15717410209\
541&17100765467&17100765469\
599&23211554291&23211554293\
651&29796600707&29796600709\
676&33362903807&33362903809\
714&39311389151&39311389153\
746&44837381087&44837381089\
790&53248211999&53248212001\
924&85200014591&85200014593\
956&94362064127&94362064129\
991&105110165267&105110165269\
endarray
$$

Note that the sum of the primes is $(6n)^3$.



This list does not include $3+5=2^3$ because $(3,5)$ is the only twin prime that is not of the form $(6k-1,6k+1)$; that is, all primes greater than $3$ must be relatively prime to $6$.




Mathematica Code



Module[s = "", m, 
For[n = 1, n < 1000, ++n,
If[MemberQ[0, 1, 4, Mod[n, 5]] && PrimeQ[(m = 108 n^3) - 1] &&
PrimeQ[m + 1],
s = StringJoin[s,
ToString[n] <> "&" <> ToString[m - 1] <> "&" <> ToString[m + 1] <>
"\n"]]]; s]





share|cite|improve this answer











$endgroup$








  • 1




    $begingroup$
    "We can immediately skip $nequiv2,3pmod5$ since $5mid108cdot2^3+1$ and $5mid108cdot3^3-1$" I don't understand this line, could you explain this a little further?
    $endgroup$
    – spyr03
    Apr 4 at 15:46






  • 3




    $begingroup$
    As $5$ divides $108cdot 2^3+1$, for any $k$ of the form $5t+2$ we have $108cdot (5t+2)^3+ 1$. Now using binomial expansion you can see that it will left $5cdot m+108cdot 2^3$, which is divisible by $5$. Hence it can't be prime. So we are not checking for that $n$. Same argument goes for $nequiv 3pmod5$.
    $endgroup$
    – OppoInfinity
    Apr 4 at 15:54










  • $begingroup$
    @spyr03: I have expanded the section about the values skipped
    $endgroup$
    – robjohn
    Apr 4 at 17:27



















11












$begingroup$

$3$ and $5$ add to $2^3$, and $107 + 109 = 6^3$. So yes, there are other examples.



Clearly the sum has to be even, so if you want to systematically look for examples, then you could look through numbers of the form
$$
frac(2n)^32pm 1
$$

and check whether they are twin primes. That's how I found the $6^3$ one, at least. I'm sure there are clever ways to cut down the search space further. Or maybe it's better to look through all twin primes and see whether they add to cubes. I have no idea which would actually be faster.




Edit Apart from $3+5$, the primes cannot be divisible by $3$ (obviously), and since neither $p$ nor $p+2$ are divisible by $3$, that means their sum is divisible by $3$. So instead of just $frac(2n)^32pm1$, you can narrow it to $frac(6n)^32pm 1$.



Once can do a similar analysis on the basis of, say, $5$, and find that $nnotequiv 2, 3pmod 5$, meaning the numerator must be on one of the forms $(30n)^3, (30n + 6)^3$ or $(30n + 24)^3$.




New edit:



I used my above idea to search with the following Python program:



import math 

def is_prime(n):
if(n%2==0):
return False
for i in range(3,int(math.sqrt(n))+1,2):
if(n%i==0):
return False
return True

for i in range(1,300):
for k in [30*i, 30*i + 6, 30*i + 24]:
if is_prime(k**3/2 - 1) & is_prime(k**3/2 + 1):
print "%d & %d & %d\\" % (k**3/2 - 1, k**3/2 + 1, k)


(The speed of the program starts to go down at about 300.)



It found the following list:
$$
beginarray
hline
p&p+2&sqrt[3]textsum\
hline
2634011 & 2634013 & 174\
29659499 & 29659501 & 390\
57395627 & 57395629 & 486\
104792291 & 104792293 & 594\
271669247 & 271669249 & 816\
485149499 & 485149501 & 990\
568946591 & 568946593 & 1044\
588791807 & 588791809 & 1056\
752530067 & 752530069 & 1146\
863999999 & 864000001 & 1200\
2032678367 & 2032678369 & 1596\
2772616499 & 2772616501 & 1770\
2945257307 & 2945257309 & 1806\
3505869971 & 3505869973 & 1914\
4473547487 & 4473547489 & 2076\
4670303507 & 4670303509 & 2106\
5470523999 & 5470524001 & 2220\
6911999999 & 6912000001 & 2400\
7498065347 & 7498065349 & 2466\
8646803027 & 8646803029 & 2586\
8828622431 & 8828622433 & 2604\
8951240447 & 8951240449 & 2616\
10240432127 & 10240432129 & 2736\
12784043267 & 12784043269 & 2946\
13019808671 & 13019808673 & 2964\
15717410207 & 15717410209 & 3156\
17100765467 & 17100765469 & 3246\
23211554291 & 23211554293 & 3594\
29796600707 & 29796600709 & 3906\
33362903807 & 33362903809 & 4056\
39311389151 & 39311389153 & 4284\
44837381087 & 44837381089 & 4476\
53248211999 & 53248212001 & 4740\
85200014591 & 85200014593 & 5544\
94362064127 & 94362064129 & 5736\
105110165267 & 105110165269 & 5946\
111603347747 & 111603347749 & 6066\
156246957827 & 156246957829 & 6786\
169013118347 & 169013118349 & 6966\
183838613471 & 183838613473 & 7164\
215526633731 & 215526633733 & 7554\
223322272991 & 223322272993 & 7644\
226492415999 & 226492416001 & 7680\
239472986111 & 239472986113 & 7824\
280145695391 & 280145695393 & 8244\
hline
endarray
$$

This skips $2^3 = 3+5$ and $6^3 = 107+109$, and $24^3 = 6911 + 6913$ (although $6913 = 31cdot 223$, so that's irrelevant), because of some hiccup with the range in the primality test that I didn't bother fixing. Thanks to @taritgoswami for the prime test I copy-pasted from him and trimmed down a little. It still thinks $2$ is non-prime, but that's OK in this case. In fact, I could theoretically have taken away the whole parity check there, since I know I'm only feeding it odd numbers.



The print statement is formatted like that so that I could copy-paste it directly from the Python output into a MathJaX array without having to manually type all the formatting necessary.






share|cite|improve this answer











$endgroup$












  • $begingroup$
    some bigger one
    $endgroup$
    – pantareis
    Apr 4 at 9:32










  • $begingroup$
    @DietrichBurde It's a cube, see the question body.
    $endgroup$
    – Arthur
    Apr 4 at 9:34










  • $begingroup$
    @DietrichBurde I'm sure we can. $17+19 = 6^2$, so $6$ is really prolific here.
    $endgroup$
    – Arthur
    Apr 4 at 9:37






  • 1




    $begingroup$
    with Maple can you find other examples?
    $endgroup$
    – pantareis
    Apr 4 at 9:41










  • $begingroup$
    @pantareis I'm sure I could. If I knew how to use Maple. Or you could do it: I've already told you one possible algorithm.
    $endgroup$
    – Arthur
    Apr 4 at 9:42



















4












$begingroup$

To demonstrate that there are also huge solutions :



Define $$k=10^100+303593$$ $$s=4k^3-1$$ $$t=4k^3+1$$ then $(s,t)$ is a twin prime pair of the desired form which can be searched with this PARI/GP - routine



? z=prod(j=1,3*10^4,prime(j));k=10^100-1;gef=0;while(gef==0,k=k+1;s=4*k^3-1;t=4*
k^3+1;if(gcd(s*t,z)==1,if(ispseudoprime(s)==1,print(k-10^100);if(ispseudoprime(t)
==1,gef=1))))


$ s $and $ t $ are proven primes with $ 301 $ digits. Assuming the generalized bunyakovsky conjecture, there are infinite many pairs of the desired form.






share|cite|improve this answer









$endgroup$




















    3












    $begingroup$

    $(3,5),(107,109)$ and $(2634011,2634013)$ are only such twin prime pairs below $10^7$. You can check for more by increasing the range using this small Python code below. I just run it upto $10^8$, $(29659499,29659501)$ and $(57395627,57395629)$ are only such pairs with $10^7<p<10^8$.




    Edit:
    For optimization purpose, I will use the fact that all primes more than $3$ can be represented in the form $6kpm 1$.



    First let check manually for $p=2,3$. For $p=2$ it's clearly not possible. For $p=3$, we have $3+5=8=2^3$, so, $(3,5)$ is such pair.



    Suppose, $p=6k-1$, with $p>5$, then we have $12k=n^3$. That means, $12|n^3$. But, as $n^3$ is a perfect cube, and we have $12=3cdot 2^2$, at least $3^3cdot 2^3=216$ will divide $n^3$. So, the pair $(108m^3-1,108m^3+1)$ will be such pair if both of them are prime.



    While dealing with cubes, usually prefer to work in $mathbbZ_7$, as any cube is either of $0,1,6$ in this field,i.e; $n^3equiv 0,1,6pmod7$ . So, we can have $2p+2equiv 0pmod7$, which gives $pequiv 6pmod7$, or, $2p+2equiv 1pmod7$ which implies $pequiv 3pmod7$ or $2p+2equiv 6pmod7$ which implies $pequiv 2pmod7$. Hence, only $3$ pssibilities. Here is the updated program:



    import math
    import time

    start_time=time.time()
    def is_prime(n):
    flag=0
    if(n==2):
    return True
    if(n%2==0):
    return False
    else:
    for i in range(3,int(math.sqrt(n))+1,2):
    if(n%i==0):
    flag=1
    break
    if(flag==0):
    return True
    return False

    for i in range(1,1000):#change the number inside this braket to check for larger numbers
    c=(6*i)**3
    p=c//2-1
    if(p%7==2 or p%7==4 or p%7==6):
    if(is_prime(p) & is_prime(p+2)):
    print(p, "is such twin prime with sum",c)

    print(time.time()-start_time)





    share|cite|improve this answer











    $endgroup$












    • $begingroup$
      I am not the downvoter, but my guess is that it is because your script, the substance of your answer, is quite inefficient compared to some others that were posted.
      $endgroup$
      – Mees de Vries
      Apr 4 at 14:32










    • $begingroup$
      @MeesdeVries Updated it, please have a look.
      $endgroup$
      – tarit goswami
      Apr 4 at 19:20


















    1












    $begingroup$

    $p + (p + 2) = 2p + 2 = 2(p + 1)$



    For the sum to be a cube, $p + 1$ must be divisible by 4, so that the sum becomes $2 times 4m^3$ for some integer $m$. So $p + 1$ is of the form $4m^3$.






    share|cite|improve this answer









    $endgroup$








    • 2




      $begingroup$
      Also, with the exception of the twin prime pair 3,5, every pair of twin primes must be of the form 6n-1,6n+1. Using your notation, you can further refine based on this to $p+1=108k^3$
      $endgroup$
      – Moko19
      Apr 4 at 9:52

















    5 Answers
    5






    active

    oldest

    votes








    5 Answers
    5






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    20












    $begingroup$

    List of Some Twin Primes Greater than $bf3$ whose Sum is a Cube



    The sum of twin primes $6k-1$ and $6k+1$ is $12k$ and $12k=j^3implies6mid j$. So to look for such twin primes, look for twin primes of the form
    $$
    (108n^3-1,108n^3+1)
    $$

    We can skip $nequiv2pmod5$ since
    $$
    beginalign
    108cdot n^3+1
    &equiv3cdot2^3+1&pmod5\
    &equiv0&pmod5
    endalign
    $$

    and we can skip $nequiv3pmod5$ since
    $$
    beginalign
    108cdot n^3-1
    &equiv3cdot3^3-1&pmod5\
    &equiv0&pmod5
    endalign
    $$

    Checking $nequiv0,1,4pmod5$, we get
    $$
    beginarrayl
    n&108n^3-1&108n^3+1\hline
    1&107&109\
    29&2634011&2634013\
    65&29659499&29659501\
    81&57395627&57395629\
    99&104792291&104792293\
    136&271669247&271669249\
    165&485149499&485149501\
    174&568946591&568946593\
    176&588791807&588791809\
    191&752530067&752530069\
    200&863999999&864000001\
    266&2032678367&2032678369\
    295&2772616499&2772616501\
    301&2945257307&2945257309\
    319&3505869971&3505869973\
    346&4473547487&4473547489\
    351&4670303507&4670303509\
    370&5470523999&5470524001\
    400&6911999999&6912000001\
    411&7498065347&7498065349\
    431&8646803027&8646803029\
    434&8828622431&8828622433\
    436&8951240447&8951240449\
    456&10240432127&10240432129\
    491&12784043267&12784043269\
    494&13019808671&13019808673\
    526&15717410207&15717410209\
    541&17100765467&17100765469\
    599&23211554291&23211554293\
    651&29796600707&29796600709\
    676&33362903807&33362903809\
    714&39311389151&39311389153\
    746&44837381087&44837381089\
    790&53248211999&53248212001\
    924&85200014591&85200014593\
    956&94362064127&94362064129\
    991&105110165267&105110165269\
    endarray
    $$

    Note that the sum of the primes is $(6n)^3$.



    This list does not include $3+5=2^3$ because $(3,5)$ is the only twin prime that is not of the form $(6k-1,6k+1)$; that is, all primes greater than $3$ must be relatively prime to $6$.




    Mathematica Code



    Module[s = "", m, 
    For[n = 1, n < 1000, ++n,
    If[MemberQ[0, 1, 4, Mod[n, 5]] && PrimeQ[(m = 108 n^3) - 1] &&
    PrimeQ[m + 1],
    s = StringJoin[s,
    ToString[n] <> "&" <> ToString[m - 1] <> "&" <> ToString[m + 1] <>
    "\n"]]]; s]





    share|cite|improve this answer











    $endgroup$








    • 1




      $begingroup$
      "We can immediately skip $nequiv2,3pmod5$ since $5mid108cdot2^3+1$ and $5mid108cdot3^3-1$" I don't understand this line, could you explain this a little further?
      $endgroup$
      – spyr03
      Apr 4 at 15:46






    • 3




      $begingroup$
      As $5$ divides $108cdot 2^3+1$, for any $k$ of the form $5t+2$ we have $108cdot (5t+2)^3+ 1$. Now using binomial expansion you can see that it will left $5cdot m+108cdot 2^3$, which is divisible by $5$. Hence it can't be prime. So we are not checking for that $n$. Same argument goes for $nequiv 3pmod5$.
      $endgroup$
      – OppoInfinity
      Apr 4 at 15:54










    • $begingroup$
      @spyr03: I have expanded the section about the values skipped
      $endgroup$
      – robjohn
      Apr 4 at 17:27
















    20












    $begingroup$

    List of Some Twin Primes Greater than $bf3$ whose Sum is a Cube



    The sum of twin primes $6k-1$ and $6k+1$ is $12k$ and $12k=j^3implies6mid j$. So to look for such twin primes, look for twin primes of the form
    $$
    (108n^3-1,108n^3+1)
    $$

    We can skip $nequiv2pmod5$ since
    $$
    beginalign
    108cdot n^3+1
    &equiv3cdot2^3+1&pmod5\
    &equiv0&pmod5
    endalign
    $$

    and we can skip $nequiv3pmod5$ since
    $$
    beginalign
    108cdot n^3-1
    &equiv3cdot3^3-1&pmod5\
    &equiv0&pmod5
    endalign
    $$

    Checking $nequiv0,1,4pmod5$, we get
    $$
    beginarrayl
    n&108n^3-1&108n^3+1\hline
    1&107&109\
    29&2634011&2634013\
    65&29659499&29659501\
    81&57395627&57395629\
    99&104792291&104792293\
    136&271669247&271669249\
    165&485149499&485149501\
    174&568946591&568946593\
    176&588791807&588791809\
    191&752530067&752530069\
    200&863999999&864000001\
    266&2032678367&2032678369\
    295&2772616499&2772616501\
    301&2945257307&2945257309\
    319&3505869971&3505869973\
    346&4473547487&4473547489\
    351&4670303507&4670303509\
    370&5470523999&5470524001\
    400&6911999999&6912000001\
    411&7498065347&7498065349\
    431&8646803027&8646803029\
    434&8828622431&8828622433\
    436&8951240447&8951240449\
    456&10240432127&10240432129\
    491&12784043267&12784043269\
    494&13019808671&13019808673\
    526&15717410207&15717410209\
    541&17100765467&17100765469\
    599&23211554291&23211554293\
    651&29796600707&29796600709\
    676&33362903807&33362903809\
    714&39311389151&39311389153\
    746&44837381087&44837381089\
    790&53248211999&53248212001\
    924&85200014591&85200014593\
    956&94362064127&94362064129\
    991&105110165267&105110165269\
    endarray
    $$

    Note that the sum of the primes is $(6n)^3$.



    This list does not include $3+5=2^3$ because $(3,5)$ is the only twin prime that is not of the form $(6k-1,6k+1)$; that is, all primes greater than $3$ must be relatively prime to $6$.




    Mathematica Code



    Module[s = "", m, 
    For[n = 1, n < 1000, ++n,
    If[MemberQ[0, 1, 4, Mod[n, 5]] && PrimeQ[(m = 108 n^3) - 1] &&
    PrimeQ[m + 1],
    s = StringJoin[s,
    ToString[n] <> "&" <> ToString[m - 1] <> "&" <> ToString[m + 1] <>
    "\n"]]]; s]





    share|cite|improve this answer











    $endgroup$








    • 1




      $begingroup$
      "We can immediately skip $nequiv2,3pmod5$ since $5mid108cdot2^3+1$ and $5mid108cdot3^3-1$" I don't understand this line, could you explain this a little further?
      $endgroup$
      – spyr03
      Apr 4 at 15:46






    • 3




      $begingroup$
      As $5$ divides $108cdot 2^3+1$, for any $k$ of the form $5t+2$ we have $108cdot (5t+2)^3+ 1$. Now using binomial expansion you can see that it will left $5cdot m+108cdot 2^3$, which is divisible by $5$. Hence it can't be prime. So we are not checking for that $n$. Same argument goes for $nequiv 3pmod5$.
      $endgroup$
      – OppoInfinity
      Apr 4 at 15:54










    • $begingroup$
      @spyr03: I have expanded the section about the values skipped
      $endgroup$
      – robjohn
      Apr 4 at 17:27














    20












    20








    20





    $begingroup$

    List of Some Twin Primes Greater than $bf3$ whose Sum is a Cube



    The sum of twin primes $6k-1$ and $6k+1$ is $12k$ and $12k=j^3implies6mid j$. So to look for such twin primes, look for twin primes of the form
    $$
    (108n^3-1,108n^3+1)
    $$

    We can skip $nequiv2pmod5$ since
    $$
    beginalign
    108cdot n^3+1
    &equiv3cdot2^3+1&pmod5\
    &equiv0&pmod5
    endalign
    $$

    and we can skip $nequiv3pmod5$ since
    $$
    beginalign
    108cdot n^3-1
    &equiv3cdot3^3-1&pmod5\
    &equiv0&pmod5
    endalign
    $$

    Checking $nequiv0,1,4pmod5$, we get
    $$
    beginarrayl
    n&108n^3-1&108n^3+1\hline
    1&107&109\
    29&2634011&2634013\
    65&29659499&29659501\
    81&57395627&57395629\
    99&104792291&104792293\
    136&271669247&271669249\
    165&485149499&485149501\
    174&568946591&568946593\
    176&588791807&588791809\
    191&752530067&752530069\
    200&863999999&864000001\
    266&2032678367&2032678369\
    295&2772616499&2772616501\
    301&2945257307&2945257309\
    319&3505869971&3505869973\
    346&4473547487&4473547489\
    351&4670303507&4670303509\
    370&5470523999&5470524001\
    400&6911999999&6912000001\
    411&7498065347&7498065349\
    431&8646803027&8646803029\
    434&8828622431&8828622433\
    436&8951240447&8951240449\
    456&10240432127&10240432129\
    491&12784043267&12784043269\
    494&13019808671&13019808673\
    526&15717410207&15717410209\
    541&17100765467&17100765469\
    599&23211554291&23211554293\
    651&29796600707&29796600709\
    676&33362903807&33362903809\
    714&39311389151&39311389153\
    746&44837381087&44837381089\
    790&53248211999&53248212001\
    924&85200014591&85200014593\
    956&94362064127&94362064129\
    991&105110165267&105110165269\
    endarray
    $$

    Note that the sum of the primes is $(6n)^3$.



    This list does not include $3+5=2^3$ because $(3,5)$ is the only twin prime that is not of the form $(6k-1,6k+1)$; that is, all primes greater than $3$ must be relatively prime to $6$.




    Mathematica Code



    Module[s = "", m, 
    For[n = 1, n < 1000, ++n,
    If[MemberQ[0, 1, 4, Mod[n, 5]] && PrimeQ[(m = 108 n^3) - 1] &&
    PrimeQ[m + 1],
    s = StringJoin[s,
    ToString[n] <> "&" <> ToString[m - 1] <> "&" <> ToString[m + 1] <>
    "\n"]]]; s]





    share|cite|improve this answer











    $endgroup$



    List of Some Twin Primes Greater than $bf3$ whose Sum is a Cube



    The sum of twin primes $6k-1$ and $6k+1$ is $12k$ and $12k=j^3implies6mid j$. So to look for such twin primes, look for twin primes of the form
    $$
    (108n^3-1,108n^3+1)
    $$

    We can skip $nequiv2pmod5$ since
    $$
    beginalign
    108cdot n^3+1
    &equiv3cdot2^3+1&pmod5\
    &equiv0&pmod5
    endalign
    $$

    and we can skip $nequiv3pmod5$ since
    $$
    beginalign
    108cdot n^3-1
    &equiv3cdot3^3-1&pmod5\
    &equiv0&pmod5
    endalign
    $$

    Checking $nequiv0,1,4pmod5$, we get
    $$
    beginarrayl
    n&108n^3-1&108n^3+1\hline
    1&107&109\
    29&2634011&2634013\
    65&29659499&29659501\
    81&57395627&57395629\
    99&104792291&104792293\
    136&271669247&271669249\
    165&485149499&485149501\
    174&568946591&568946593\
    176&588791807&588791809\
    191&752530067&752530069\
    200&863999999&864000001\
    266&2032678367&2032678369\
    295&2772616499&2772616501\
    301&2945257307&2945257309\
    319&3505869971&3505869973\
    346&4473547487&4473547489\
    351&4670303507&4670303509\
    370&5470523999&5470524001\
    400&6911999999&6912000001\
    411&7498065347&7498065349\
    431&8646803027&8646803029\
    434&8828622431&8828622433\
    436&8951240447&8951240449\
    456&10240432127&10240432129\
    491&12784043267&12784043269\
    494&13019808671&13019808673\
    526&15717410207&15717410209\
    541&17100765467&17100765469\
    599&23211554291&23211554293\
    651&29796600707&29796600709\
    676&33362903807&33362903809\
    714&39311389151&39311389153\
    746&44837381087&44837381089\
    790&53248211999&53248212001\
    924&85200014591&85200014593\
    956&94362064127&94362064129\
    991&105110165267&105110165269\
    endarray
    $$

    Note that the sum of the primes is $(6n)^3$.



    This list does not include $3+5=2^3$ because $(3,5)$ is the only twin prime that is not of the form $(6k-1,6k+1)$; that is, all primes greater than $3$ must be relatively prime to $6$.




    Mathematica Code



    Module[s = "", m, 
    For[n = 1, n < 1000, ++n,
    If[MemberQ[0, 1, 4, Mod[n, 5]] && PrimeQ[(m = 108 n^3) - 1] &&
    PrimeQ[m + 1],
    s = StringJoin[s,
    ToString[n] <> "&" <> ToString[m - 1] <> "&" <> ToString[m + 1] <>
    "\n"]]]; s]






    share|cite|improve this answer














    share|cite|improve this answer



    share|cite|improve this answer








    edited 2 days ago









    Community

    1




    1










    answered Apr 4 at 12:20









    robjohnrobjohn

    270k27313642




    270k27313642







    • 1




      $begingroup$
      "We can immediately skip $nequiv2,3pmod5$ since $5mid108cdot2^3+1$ and $5mid108cdot3^3-1$" I don't understand this line, could you explain this a little further?
      $endgroup$
      – spyr03
      Apr 4 at 15:46






    • 3




      $begingroup$
      As $5$ divides $108cdot 2^3+1$, for any $k$ of the form $5t+2$ we have $108cdot (5t+2)^3+ 1$. Now using binomial expansion you can see that it will left $5cdot m+108cdot 2^3$, which is divisible by $5$. Hence it can't be prime. So we are not checking for that $n$. Same argument goes for $nequiv 3pmod5$.
      $endgroup$
      – OppoInfinity
      Apr 4 at 15:54










    • $begingroup$
      @spyr03: I have expanded the section about the values skipped
      $endgroup$
      – robjohn
      Apr 4 at 17:27













    • 1




      $begingroup$
      "We can immediately skip $nequiv2,3pmod5$ since $5mid108cdot2^3+1$ and $5mid108cdot3^3-1$" I don't understand this line, could you explain this a little further?
      $endgroup$
      – spyr03
      Apr 4 at 15:46






    • 3




      $begingroup$
      As $5$ divides $108cdot 2^3+1$, for any $k$ of the form $5t+2$ we have $108cdot (5t+2)^3+ 1$. Now using binomial expansion you can see that it will left $5cdot m+108cdot 2^3$, which is divisible by $5$. Hence it can't be prime. So we are not checking for that $n$. Same argument goes for $nequiv 3pmod5$.
      $endgroup$
      – OppoInfinity
      Apr 4 at 15:54










    • $begingroup$
      @spyr03: I have expanded the section about the values skipped
      $endgroup$
      – robjohn
      Apr 4 at 17:27








    1




    1




    $begingroup$
    "We can immediately skip $nequiv2,3pmod5$ since $5mid108cdot2^3+1$ and $5mid108cdot3^3-1$" I don't understand this line, could you explain this a little further?
    $endgroup$
    – spyr03
    Apr 4 at 15:46




    $begingroup$
    "We can immediately skip $nequiv2,3pmod5$ since $5mid108cdot2^3+1$ and $5mid108cdot3^3-1$" I don't understand this line, could you explain this a little further?
    $endgroup$
    – spyr03
    Apr 4 at 15:46




    3




    3




    $begingroup$
    As $5$ divides $108cdot 2^3+1$, for any $k$ of the form $5t+2$ we have $108cdot (5t+2)^3+ 1$. Now using binomial expansion you can see that it will left $5cdot m+108cdot 2^3$, which is divisible by $5$. Hence it can't be prime. So we are not checking for that $n$. Same argument goes for $nequiv 3pmod5$.
    $endgroup$
    – OppoInfinity
    Apr 4 at 15:54




    $begingroup$
    As $5$ divides $108cdot 2^3+1$, for any $k$ of the form $5t+2$ we have $108cdot (5t+2)^3+ 1$. Now using binomial expansion you can see that it will left $5cdot m+108cdot 2^3$, which is divisible by $5$. Hence it can't be prime. So we are not checking for that $n$. Same argument goes for $nequiv 3pmod5$.
    $endgroup$
    – OppoInfinity
    Apr 4 at 15:54












    $begingroup$
    @spyr03: I have expanded the section about the values skipped
    $endgroup$
    – robjohn
    Apr 4 at 17:27





    $begingroup$
    @spyr03: I have expanded the section about the values skipped
    $endgroup$
    – robjohn
    Apr 4 at 17:27












    11












    $begingroup$

    $3$ and $5$ add to $2^3$, and $107 + 109 = 6^3$. So yes, there are other examples.



    Clearly the sum has to be even, so if you want to systematically look for examples, then you could look through numbers of the form
    $$
    frac(2n)^32pm 1
    $$

    and check whether they are twin primes. That's how I found the $6^3$ one, at least. I'm sure there are clever ways to cut down the search space further. Or maybe it's better to look through all twin primes and see whether they add to cubes. I have no idea which would actually be faster.




    Edit Apart from $3+5$, the primes cannot be divisible by $3$ (obviously), and since neither $p$ nor $p+2$ are divisible by $3$, that means their sum is divisible by $3$. So instead of just $frac(2n)^32pm1$, you can narrow it to $frac(6n)^32pm 1$.



    Once can do a similar analysis on the basis of, say, $5$, and find that $nnotequiv 2, 3pmod 5$, meaning the numerator must be on one of the forms $(30n)^3, (30n + 6)^3$ or $(30n + 24)^3$.




    New edit:



    I used my above idea to search with the following Python program:



    import math 

    def is_prime(n):
    if(n%2==0):
    return False
    for i in range(3,int(math.sqrt(n))+1,2):
    if(n%i==0):
    return False
    return True

    for i in range(1,300):
    for k in [30*i, 30*i + 6, 30*i + 24]:
    if is_prime(k**3/2 - 1) & is_prime(k**3/2 + 1):
    print "%d & %d & %d\\" % (k**3/2 - 1, k**3/2 + 1, k)


    (The speed of the program starts to go down at about 300.)



    It found the following list:
    $$
    beginarray
    hline
    p&p+2&sqrt[3]textsum\
    hline
    2634011 & 2634013 & 174\
    29659499 & 29659501 & 390\
    57395627 & 57395629 & 486\
    104792291 & 104792293 & 594\
    271669247 & 271669249 & 816\
    485149499 & 485149501 & 990\
    568946591 & 568946593 & 1044\
    588791807 & 588791809 & 1056\
    752530067 & 752530069 & 1146\
    863999999 & 864000001 & 1200\
    2032678367 & 2032678369 & 1596\
    2772616499 & 2772616501 & 1770\
    2945257307 & 2945257309 & 1806\
    3505869971 & 3505869973 & 1914\
    4473547487 & 4473547489 & 2076\
    4670303507 & 4670303509 & 2106\
    5470523999 & 5470524001 & 2220\
    6911999999 & 6912000001 & 2400\
    7498065347 & 7498065349 & 2466\
    8646803027 & 8646803029 & 2586\
    8828622431 & 8828622433 & 2604\
    8951240447 & 8951240449 & 2616\
    10240432127 & 10240432129 & 2736\
    12784043267 & 12784043269 & 2946\
    13019808671 & 13019808673 & 2964\
    15717410207 & 15717410209 & 3156\
    17100765467 & 17100765469 & 3246\
    23211554291 & 23211554293 & 3594\
    29796600707 & 29796600709 & 3906\
    33362903807 & 33362903809 & 4056\
    39311389151 & 39311389153 & 4284\
    44837381087 & 44837381089 & 4476\
    53248211999 & 53248212001 & 4740\
    85200014591 & 85200014593 & 5544\
    94362064127 & 94362064129 & 5736\
    105110165267 & 105110165269 & 5946\
    111603347747 & 111603347749 & 6066\
    156246957827 & 156246957829 & 6786\
    169013118347 & 169013118349 & 6966\
    183838613471 & 183838613473 & 7164\
    215526633731 & 215526633733 & 7554\
    223322272991 & 223322272993 & 7644\
    226492415999 & 226492416001 & 7680\
    239472986111 & 239472986113 & 7824\
    280145695391 & 280145695393 & 8244\
    hline
    endarray
    $$

    This skips $2^3 = 3+5$ and $6^3 = 107+109$, and $24^3 = 6911 + 6913$ (although $6913 = 31cdot 223$, so that's irrelevant), because of some hiccup with the range in the primality test that I didn't bother fixing. Thanks to @taritgoswami for the prime test I copy-pasted from him and trimmed down a little. It still thinks $2$ is non-prime, but that's OK in this case. In fact, I could theoretically have taken away the whole parity check there, since I know I'm only feeding it odd numbers.



    The print statement is formatted like that so that I could copy-paste it directly from the Python output into a MathJaX array without having to manually type all the formatting necessary.






    share|cite|improve this answer











    $endgroup$












    • $begingroup$
      some bigger one
      $endgroup$
      – pantareis
      Apr 4 at 9:32










    • $begingroup$
      @DietrichBurde It's a cube, see the question body.
      $endgroup$
      – Arthur
      Apr 4 at 9:34










    • $begingroup$
      @DietrichBurde I'm sure we can. $17+19 = 6^2$, so $6$ is really prolific here.
      $endgroup$
      – Arthur
      Apr 4 at 9:37






    • 1




      $begingroup$
      with Maple can you find other examples?
      $endgroup$
      – pantareis
      Apr 4 at 9:41










    • $begingroup$
      @pantareis I'm sure I could. If I knew how to use Maple. Or you could do it: I've already told you one possible algorithm.
      $endgroup$
      – Arthur
      Apr 4 at 9:42
















    11












    $begingroup$

    $3$ and $5$ add to $2^3$, and $107 + 109 = 6^3$. So yes, there are other examples.



    Clearly the sum has to be even, so if you want to systematically look for examples, then you could look through numbers of the form
    $$
    frac(2n)^32pm 1
    $$

    and check whether they are twin primes. That's how I found the $6^3$ one, at least. I'm sure there are clever ways to cut down the search space further. Or maybe it's better to look through all twin primes and see whether they add to cubes. I have no idea which would actually be faster.




    Edit Apart from $3+5$, the primes cannot be divisible by $3$ (obviously), and since neither $p$ nor $p+2$ are divisible by $3$, that means their sum is divisible by $3$. So instead of just $frac(2n)^32pm1$, you can narrow it to $frac(6n)^32pm 1$.



    Once can do a similar analysis on the basis of, say, $5$, and find that $nnotequiv 2, 3pmod 5$, meaning the numerator must be on one of the forms $(30n)^3, (30n + 6)^3$ or $(30n + 24)^3$.




    New edit:



    I used my above idea to search with the following Python program:



    import math 

    def is_prime(n):
    if(n%2==0):
    return False
    for i in range(3,int(math.sqrt(n))+1,2):
    if(n%i==0):
    return False
    return True

    for i in range(1,300):
    for k in [30*i, 30*i + 6, 30*i + 24]:
    if is_prime(k**3/2 - 1) & is_prime(k**3/2 + 1):
    print "%d & %d & %d\\" % (k**3/2 - 1, k**3/2 + 1, k)


    (The speed of the program starts to go down at about 300.)



    It found the following list:
    $$
    beginarray
    hline
    p&p+2&sqrt[3]textsum\
    hline
    2634011 & 2634013 & 174\
    29659499 & 29659501 & 390\
    57395627 & 57395629 & 486\
    104792291 & 104792293 & 594\
    271669247 & 271669249 & 816\
    485149499 & 485149501 & 990\
    568946591 & 568946593 & 1044\
    588791807 & 588791809 & 1056\
    752530067 & 752530069 & 1146\
    863999999 & 864000001 & 1200\
    2032678367 & 2032678369 & 1596\
    2772616499 & 2772616501 & 1770\
    2945257307 & 2945257309 & 1806\
    3505869971 & 3505869973 & 1914\
    4473547487 & 4473547489 & 2076\
    4670303507 & 4670303509 & 2106\
    5470523999 & 5470524001 & 2220\
    6911999999 & 6912000001 & 2400\
    7498065347 & 7498065349 & 2466\
    8646803027 & 8646803029 & 2586\
    8828622431 & 8828622433 & 2604\
    8951240447 & 8951240449 & 2616\
    10240432127 & 10240432129 & 2736\
    12784043267 & 12784043269 & 2946\
    13019808671 & 13019808673 & 2964\
    15717410207 & 15717410209 & 3156\
    17100765467 & 17100765469 & 3246\
    23211554291 & 23211554293 & 3594\
    29796600707 & 29796600709 & 3906\
    33362903807 & 33362903809 & 4056\
    39311389151 & 39311389153 & 4284\
    44837381087 & 44837381089 & 4476\
    53248211999 & 53248212001 & 4740\
    85200014591 & 85200014593 & 5544\
    94362064127 & 94362064129 & 5736\
    105110165267 & 105110165269 & 5946\
    111603347747 & 111603347749 & 6066\
    156246957827 & 156246957829 & 6786\
    169013118347 & 169013118349 & 6966\
    183838613471 & 183838613473 & 7164\
    215526633731 & 215526633733 & 7554\
    223322272991 & 223322272993 & 7644\
    226492415999 & 226492416001 & 7680\
    239472986111 & 239472986113 & 7824\
    280145695391 & 280145695393 & 8244\
    hline
    endarray
    $$

    This skips $2^3 = 3+5$ and $6^3 = 107+109$, and $24^3 = 6911 + 6913$ (although $6913 = 31cdot 223$, so that's irrelevant), because of some hiccup with the range in the primality test that I didn't bother fixing. Thanks to @taritgoswami for the prime test I copy-pasted from him and trimmed down a little. It still thinks $2$ is non-prime, but that's OK in this case. In fact, I could theoretically have taken away the whole parity check there, since I know I'm only feeding it odd numbers.



    The print statement is formatted like that so that I could copy-paste it directly from the Python output into a MathJaX array without having to manually type all the formatting necessary.






    share|cite|improve this answer











    $endgroup$












    • $begingroup$
      some bigger one
      $endgroup$
      – pantareis
      Apr 4 at 9:32










    • $begingroup$
      @DietrichBurde It's a cube, see the question body.
      $endgroup$
      – Arthur
      Apr 4 at 9:34










    • $begingroup$
      @DietrichBurde I'm sure we can. $17+19 = 6^2$, so $6$ is really prolific here.
      $endgroup$
      – Arthur
      Apr 4 at 9:37






    • 1




      $begingroup$
      with Maple can you find other examples?
      $endgroup$
      – pantareis
      Apr 4 at 9:41










    • $begingroup$
      @pantareis I'm sure I could. If I knew how to use Maple. Or you could do it: I've already told you one possible algorithm.
      $endgroup$
      – Arthur
      Apr 4 at 9:42














    11












    11








    11





    $begingroup$

    $3$ and $5$ add to $2^3$, and $107 + 109 = 6^3$. So yes, there are other examples.



    Clearly the sum has to be even, so if you want to systematically look for examples, then you could look through numbers of the form
    $$
    frac(2n)^32pm 1
    $$

    and check whether they are twin primes. That's how I found the $6^3$ one, at least. I'm sure there are clever ways to cut down the search space further. Or maybe it's better to look through all twin primes and see whether they add to cubes. I have no idea which would actually be faster.




    Edit Apart from $3+5$, the primes cannot be divisible by $3$ (obviously), and since neither $p$ nor $p+2$ are divisible by $3$, that means their sum is divisible by $3$. So instead of just $frac(2n)^32pm1$, you can narrow it to $frac(6n)^32pm 1$.



    Once can do a similar analysis on the basis of, say, $5$, and find that $nnotequiv 2, 3pmod 5$, meaning the numerator must be on one of the forms $(30n)^3, (30n + 6)^3$ or $(30n + 24)^3$.




    New edit:



    I used my above idea to search with the following Python program:



    import math 

    def is_prime(n):
    if(n%2==0):
    return False
    for i in range(3,int(math.sqrt(n))+1,2):
    if(n%i==0):
    return False
    return True

    for i in range(1,300):
    for k in [30*i, 30*i + 6, 30*i + 24]:
    if is_prime(k**3/2 - 1) & is_prime(k**3/2 + 1):
    print "%d & %d & %d\\" % (k**3/2 - 1, k**3/2 + 1, k)


    (The speed of the program starts to go down at about 300.)



    It found the following list:
    $$
    beginarray
    hline
    p&p+2&sqrt[3]textsum\
    hline
    2634011 & 2634013 & 174\
    29659499 & 29659501 & 390\
    57395627 & 57395629 & 486\
    104792291 & 104792293 & 594\
    271669247 & 271669249 & 816\
    485149499 & 485149501 & 990\
    568946591 & 568946593 & 1044\
    588791807 & 588791809 & 1056\
    752530067 & 752530069 & 1146\
    863999999 & 864000001 & 1200\
    2032678367 & 2032678369 & 1596\
    2772616499 & 2772616501 & 1770\
    2945257307 & 2945257309 & 1806\
    3505869971 & 3505869973 & 1914\
    4473547487 & 4473547489 & 2076\
    4670303507 & 4670303509 & 2106\
    5470523999 & 5470524001 & 2220\
    6911999999 & 6912000001 & 2400\
    7498065347 & 7498065349 & 2466\
    8646803027 & 8646803029 & 2586\
    8828622431 & 8828622433 & 2604\
    8951240447 & 8951240449 & 2616\
    10240432127 & 10240432129 & 2736\
    12784043267 & 12784043269 & 2946\
    13019808671 & 13019808673 & 2964\
    15717410207 & 15717410209 & 3156\
    17100765467 & 17100765469 & 3246\
    23211554291 & 23211554293 & 3594\
    29796600707 & 29796600709 & 3906\
    33362903807 & 33362903809 & 4056\
    39311389151 & 39311389153 & 4284\
    44837381087 & 44837381089 & 4476\
    53248211999 & 53248212001 & 4740\
    85200014591 & 85200014593 & 5544\
    94362064127 & 94362064129 & 5736\
    105110165267 & 105110165269 & 5946\
    111603347747 & 111603347749 & 6066\
    156246957827 & 156246957829 & 6786\
    169013118347 & 169013118349 & 6966\
    183838613471 & 183838613473 & 7164\
    215526633731 & 215526633733 & 7554\
    223322272991 & 223322272993 & 7644\
    226492415999 & 226492416001 & 7680\
    239472986111 & 239472986113 & 7824\
    280145695391 & 280145695393 & 8244\
    hline
    endarray
    $$

    This skips $2^3 = 3+5$ and $6^3 = 107+109$, and $24^3 = 6911 + 6913$ (although $6913 = 31cdot 223$, so that's irrelevant), because of some hiccup with the range in the primality test that I didn't bother fixing. Thanks to @taritgoswami for the prime test I copy-pasted from him and trimmed down a little. It still thinks $2$ is non-prime, but that's OK in this case. In fact, I could theoretically have taken away the whole parity check there, since I know I'm only feeding it odd numbers.



    The print statement is formatted like that so that I could copy-paste it directly from the Python output into a MathJaX array without having to manually type all the formatting necessary.






    share|cite|improve this answer











    $endgroup$



    $3$ and $5$ add to $2^3$, and $107 + 109 = 6^3$. So yes, there are other examples.



    Clearly the sum has to be even, so if you want to systematically look for examples, then you could look through numbers of the form
    $$
    frac(2n)^32pm 1
    $$

    and check whether they are twin primes. That's how I found the $6^3$ one, at least. I'm sure there are clever ways to cut down the search space further. Or maybe it's better to look through all twin primes and see whether they add to cubes. I have no idea which would actually be faster.




    Edit Apart from $3+5$, the primes cannot be divisible by $3$ (obviously), and since neither $p$ nor $p+2$ are divisible by $3$, that means their sum is divisible by $3$. So instead of just $frac(2n)^32pm1$, you can narrow it to $frac(6n)^32pm 1$.



    Once can do a similar analysis on the basis of, say, $5$, and find that $nnotequiv 2, 3pmod 5$, meaning the numerator must be on one of the forms $(30n)^3, (30n + 6)^3$ or $(30n + 24)^3$.




    New edit:



    I used my above idea to search with the following Python program:



    import math 

    def is_prime(n):
    if(n%2==0):
    return False
    for i in range(3,int(math.sqrt(n))+1,2):
    if(n%i==0):
    return False
    return True

    for i in range(1,300):
    for k in [30*i, 30*i + 6, 30*i + 24]:
    if is_prime(k**3/2 - 1) & is_prime(k**3/2 + 1):
    print "%d & %d & %d\\" % (k**3/2 - 1, k**3/2 + 1, k)


    (The speed of the program starts to go down at about 300.)



    It found the following list:
    $$
    beginarray
    hline
    p&p+2&sqrt[3]textsum\
    hline
    2634011 & 2634013 & 174\
    29659499 & 29659501 & 390\
    57395627 & 57395629 & 486\
    104792291 & 104792293 & 594\
    271669247 & 271669249 & 816\
    485149499 & 485149501 & 990\
    568946591 & 568946593 & 1044\
    588791807 & 588791809 & 1056\
    752530067 & 752530069 & 1146\
    863999999 & 864000001 & 1200\
    2032678367 & 2032678369 & 1596\
    2772616499 & 2772616501 & 1770\
    2945257307 & 2945257309 & 1806\
    3505869971 & 3505869973 & 1914\
    4473547487 & 4473547489 & 2076\
    4670303507 & 4670303509 & 2106\
    5470523999 & 5470524001 & 2220\
    6911999999 & 6912000001 & 2400\
    7498065347 & 7498065349 & 2466\
    8646803027 & 8646803029 & 2586\
    8828622431 & 8828622433 & 2604\
    8951240447 & 8951240449 & 2616\
    10240432127 & 10240432129 & 2736\
    12784043267 & 12784043269 & 2946\
    13019808671 & 13019808673 & 2964\
    15717410207 & 15717410209 & 3156\
    17100765467 & 17100765469 & 3246\
    23211554291 & 23211554293 & 3594\
    29796600707 & 29796600709 & 3906\
    33362903807 & 33362903809 & 4056\
    39311389151 & 39311389153 & 4284\
    44837381087 & 44837381089 & 4476\
    53248211999 & 53248212001 & 4740\
    85200014591 & 85200014593 & 5544\
    94362064127 & 94362064129 & 5736\
    105110165267 & 105110165269 & 5946\
    111603347747 & 111603347749 & 6066\
    156246957827 & 156246957829 & 6786\
    169013118347 & 169013118349 & 6966\
    183838613471 & 183838613473 & 7164\
    215526633731 & 215526633733 & 7554\
    223322272991 & 223322272993 & 7644\
    226492415999 & 226492416001 & 7680\
    239472986111 & 239472986113 & 7824\
    280145695391 & 280145695393 & 8244\
    hline
    endarray
    $$

    This skips $2^3 = 3+5$ and $6^3 = 107+109$, and $24^3 = 6911 + 6913$ (although $6913 = 31cdot 223$, so that's irrelevant), because of some hiccup with the range in the primality test that I didn't bother fixing. Thanks to @taritgoswami for the prime test I copy-pasted from him and trimmed down a little. It still thinks $2$ is non-prime, but that's OK in this case. In fact, I could theoretically have taken away the whole parity check there, since I know I'm only feeding it odd numbers.



    The print statement is formatted like that so that I could copy-paste it directly from the Python output into a MathJaX array without having to manually type all the formatting necessary.







    share|cite|improve this answer














    share|cite|improve this answer



    share|cite|improve this answer








    edited Apr 4 at 11:12

























    answered Apr 4 at 9:31









    ArthurArthur

    122k7122211




    122k7122211











    • $begingroup$
      some bigger one
      $endgroup$
      – pantareis
      Apr 4 at 9:32










    • $begingroup$
      @DietrichBurde It's a cube, see the question body.
      $endgroup$
      – Arthur
      Apr 4 at 9:34










    • $begingroup$
      @DietrichBurde I'm sure we can. $17+19 = 6^2$, so $6$ is really prolific here.
      $endgroup$
      – Arthur
      Apr 4 at 9:37






    • 1




      $begingroup$
      with Maple can you find other examples?
      $endgroup$
      – pantareis
      Apr 4 at 9:41










    • $begingroup$
      @pantareis I'm sure I could. If I knew how to use Maple. Or you could do it: I've already told you one possible algorithm.
      $endgroup$
      – Arthur
      Apr 4 at 9:42

















    • $begingroup$
      some bigger one
      $endgroup$
      – pantareis
      Apr 4 at 9:32










    • $begingroup$
      @DietrichBurde It's a cube, see the question body.
      $endgroup$
      – Arthur
      Apr 4 at 9:34










    • $begingroup$
      @DietrichBurde I'm sure we can. $17+19 = 6^2$, so $6$ is really prolific here.
      $endgroup$
      – Arthur
      Apr 4 at 9:37






    • 1




      $begingroup$
      with Maple can you find other examples?
      $endgroup$
      – pantareis
      Apr 4 at 9:41










    • $begingroup$
      @pantareis I'm sure I could. If I knew how to use Maple. Or you could do it: I've already told you one possible algorithm.
      $endgroup$
      – Arthur
      Apr 4 at 9:42
















    $begingroup$
    some bigger one
    $endgroup$
    – pantareis
    Apr 4 at 9:32




    $begingroup$
    some bigger one
    $endgroup$
    – pantareis
    Apr 4 at 9:32












    $begingroup$
    @DietrichBurde It's a cube, see the question body.
    $endgroup$
    – Arthur
    Apr 4 at 9:34




    $begingroup$
    @DietrichBurde It's a cube, see the question body.
    $endgroup$
    – Arthur
    Apr 4 at 9:34












    $begingroup$
    @DietrichBurde I'm sure we can. $17+19 = 6^2$, so $6$ is really prolific here.
    $endgroup$
    – Arthur
    Apr 4 at 9:37




    $begingroup$
    @DietrichBurde I'm sure we can. $17+19 = 6^2$, so $6$ is really prolific here.
    $endgroup$
    – Arthur
    Apr 4 at 9:37




    1




    1




    $begingroup$
    with Maple can you find other examples?
    $endgroup$
    – pantareis
    Apr 4 at 9:41




    $begingroup$
    with Maple can you find other examples?
    $endgroup$
    – pantareis
    Apr 4 at 9:41












    $begingroup$
    @pantareis I'm sure I could. If I knew how to use Maple. Or you could do it: I've already told you one possible algorithm.
    $endgroup$
    – Arthur
    Apr 4 at 9:42





    $begingroup$
    @pantareis I'm sure I could. If I knew how to use Maple. Or you could do it: I've already told you one possible algorithm.
    $endgroup$
    – Arthur
    Apr 4 at 9:42












    4












    $begingroup$

    To demonstrate that there are also huge solutions :



    Define $$k=10^100+303593$$ $$s=4k^3-1$$ $$t=4k^3+1$$ then $(s,t)$ is a twin prime pair of the desired form which can be searched with this PARI/GP - routine



    ? z=prod(j=1,3*10^4,prime(j));k=10^100-1;gef=0;while(gef==0,k=k+1;s=4*k^3-1;t=4*
    k^3+1;if(gcd(s*t,z)==1,if(ispseudoprime(s)==1,print(k-10^100);if(ispseudoprime(t)
    ==1,gef=1))))


    $ s $and $ t $ are proven primes with $ 301 $ digits. Assuming the generalized bunyakovsky conjecture, there are infinite many pairs of the desired form.






    share|cite|improve this answer









    $endgroup$

















      4












      $begingroup$

      To demonstrate that there are also huge solutions :



      Define $$k=10^100+303593$$ $$s=4k^3-1$$ $$t=4k^3+1$$ then $(s,t)$ is a twin prime pair of the desired form which can be searched with this PARI/GP - routine



      ? z=prod(j=1,3*10^4,prime(j));k=10^100-1;gef=0;while(gef==0,k=k+1;s=4*k^3-1;t=4*
      k^3+1;if(gcd(s*t,z)==1,if(ispseudoprime(s)==1,print(k-10^100);if(ispseudoprime(t)
      ==1,gef=1))))


      $ s $and $ t $ are proven primes with $ 301 $ digits. Assuming the generalized bunyakovsky conjecture, there are infinite many pairs of the desired form.






      share|cite|improve this answer









      $endgroup$















        4












        4








        4





        $begingroup$

        To demonstrate that there are also huge solutions :



        Define $$k=10^100+303593$$ $$s=4k^3-1$$ $$t=4k^3+1$$ then $(s,t)$ is a twin prime pair of the desired form which can be searched with this PARI/GP - routine



        ? z=prod(j=1,3*10^4,prime(j));k=10^100-1;gef=0;while(gef==0,k=k+1;s=4*k^3-1;t=4*
        k^3+1;if(gcd(s*t,z)==1,if(ispseudoprime(s)==1,print(k-10^100);if(ispseudoprime(t)
        ==1,gef=1))))


        $ s $and $ t $ are proven primes with $ 301 $ digits. Assuming the generalized bunyakovsky conjecture, there are infinite many pairs of the desired form.






        share|cite|improve this answer









        $endgroup$



        To demonstrate that there are also huge solutions :



        Define $$k=10^100+303593$$ $$s=4k^3-1$$ $$t=4k^3+1$$ then $(s,t)$ is a twin prime pair of the desired form which can be searched with this PARI/GP - routine



        ? z=prod(j=1,3*10^4,prime(j));k=10^100-1;gef=0;while(gef==0,k=k+1;s=4*k^3-1;t=4*
        k^3+1;if(gcd(s*t,z)==1,if(ispseudoprime(s)==1,print(k-10^100);if(ispseudoprime(t)
        ==1,gef=1))))


        $ s $and $ t $ are proven primes with $ 301 $ digits. Assuming the generalized bunyakovsky conjecture, there are infinite many pairs of the desired form.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Apr 4 at 11:34









        PeterPeter

        49.1k1240138




        49.1k1240138





















            3












            $begingroup$

            $(3,5),(107,109)$ and $(2634011,2634013)$ are only such twin prime pairs below $10^7$. You can check for more by increasing the range using this small Python code below. I just run it upto $10^8$, $(29659499,29659501)$ and $(57395627,57395629)$ are only such pairs with $10^7<p<10^8$.




            Edit:
            For optimization purpose, I will use the fact that all primes more than $3$ can be represented in the form $6kpm 1$.



            First let check manually for $p=2,3$. For $p=2$ it's clearly not possible. For $p=3$, we have $3+5=8=2^3$, so, $(3,5)$ is such pair.



            Suppose, $p=6k-1$, with $p>5$, then we have $12k=n^3$. That means, $12|n^3$. But, as $n^3$ is a perfect cube, and we have $12=3cdot 2^2$, at least $3^3cdot 2^3=216$ will divide $n^3$. So, the pair $(108m^3-1,108m^3+1)$ will be such pair if both of them are prime.



            While dealing with cubes, usually prefer to work in $mathbbZ_7$, as any cube is either of $0,1,6$ in this field,i.e; $n^3equiv 0,1,6pmod7$ . So, we can have $2p+2equiv 0pmod7$, which gives $pequiv 6pmod7$, or, $2p+2equiv 1pmod7$ which implies $pequiv 3pmod7$ or $2p+2equiv 6pmod7$ which implies $pequiv 2pmod7$. Hence, only $3$ pssibilities. Here is the updated program:



            import math
            import time

            start_time=time.time()
            def is_prime(n):
            flag=0
            if(n==2):
            return True
            if(n%2==0):
            return False
            else:
            for i in range(3,int(math.sqrt(n))+1,2):
            if(n%i==0):
            flag=1
            break
            if(flag==0):
            return True
            return False

            for i in range(1,1000):#change the number inside this braket to check for larger numbers
            c=(6*i)**3
            p=c//2-1
            if(p%7==2 or p%7==4 or p%7==6):
            if(is_prime(p) & is_prime(p+2)):
            print(p, "is such twin prime with sum",c)

            print(time.time()-start_time)





            share|cite|improve this answer











            $endgroup$












            • $begingroup$
              I am not the downvoter, but my guess is that it is because your script, the substance of your answer, is quite inefficient compared to some others that were posted.
              $endgroup$
              – Mees de Vries
              Apr 4 at 14:32










            • $begingroup$
              @MeesdeVries Updated it, please have a look.
              $endgroup$
              – tarit goswami
              Apr 4 at 19:20















            3












            $begingroup$

            $(3,5),(107,109)$ and $(2634011,2634013)$ are only such twin prime pairs below $10^7$. You can check for more by increasing the range using this small Python code below. I just run it upto $10^8$, $(29659499,29659501)$ and $(57395627,57395629)$ are only such pairs with $10^7<p<10^8$.




            Edit:
            For optimization purpose, I will use the fact that all primes more than $3$ can be represented in the form $6kpm 1$.



            First let check manually for $p=2,3$. For $p=2$ it's clearly not possible. For $p=3$, we have $3+5=8=2^3$, so, $(3,5)$ is such pair.



            Suppose, $p=6k-1$, with $p>5$, then we have $12k=n^3$. That means, $12|n^3$. But, as $n^3$ is a perfect cube, and we have $12=3cdot 2^2$, at least $3^3cdot 2^3=216$ will divide $n^3$. So, the pair $(108m^3-1,108m^3+1)$ will be such pair if both of them are prime.



            While dealing with cubes, usually prefer to work in $mathbbZ_7$, as any cube is either of $0,1,6$ in this field,i.e; $n^3equiv 0,1,6pmod7$ . So, we can have $2p+2equiv 0pmod7$, which gives $pequiv 6pmod7$, or, $2p+2equiv 1pmod7$ which implies $pequiv 3pmod7$ or $2p+2equiv 6pmod7$ which implies $pequiv 2pmod7$. Hence, only $3$ pssibilities. Here is the updated program:



            import math
            import time

            start_time=time.time()
            def is_prime(n):
            flag=0
            if(n==2):
            return True
            if(n%2==0):
            return False
            else:
            for i in range(3,int(math.sqrt(n))+1,2):
            if(n%i==0):
            flag=1
            break
            if(flag==0):
            return True
            return False

            for i in range(1,1000):#change the number inside this braket to check for larger numbers
            c=(6*i)**3
            p=c//2-1
            if(p%7==2 or p%7==4 or p%7==6):
            if(is_prime(p) & is_prime(p+2)):
            print(p, "is such twin prime with sum",c)

            print(time.time()-start_time)





            share|cite|improve this answer











            $endgroup$












            • $begingroup$
              I am not the downvoter, but my guess is that it is because your script, the substance of your answer, is quite inefficient compared to some others that were posted.
              $endgroup$
              – Mees de Vries
              Apr 4 at 14:32










            • $begingroup$
              @MeesdeVries Updated it, please have a look.
              $endgroup$
              – tarit goswami
              Apr 4 at 19:20













            3












            3








            3





            $begingroup$

            $(3,5),(107,109)$ and $(2634011,2634013)$ are only such twin prime pairs below $10^7$. You can check for more by increasing the range using this small Python code below. I just run it upto $10^8$, $(29659499,29659501)$ and $(57395627,57395629)$ are only such pairs with $10^7<p<10^8$.




            Edit:
            For optimization purpose, I will use the fact that all primes more than $3$ can be represented in the form $6kpm 1$.



            First let check manually for $p=2,3$. For $p=2$ it's clearly not possible. For $p=3$, we have $3+5=8=2^3$, so, $(3,5)$ is such pair.



            Suppose, $p=6k-1$, with $p>5$, then we have $12k=n^3$. That means, $12|n^3$. But, as $n^3$ is a perfect cube, and we have $12=3cdot 2^2$, at least $3^3cdot 2^3=216$ will divide $n^3$. So, the pair $(108m^3-1,108m^3+1)$ will be such pair if both of them are prime.



            While dealing with cubes, usually prefer to work in $mathbbZ_7$, as any cube is either of $0,1,6$ in this field,i.e; $n^3equiv 0,1,6pmod7$ . So, we can have $2p+2equiv 0pmod7$, which gives $pequiv 6pmod7$, or, $2p+2equiv 1pmod7$ which implies $pequiv 3pmod7$ or $2p+2equiv 6pmod7$ which implies $pequiv 2pmod7$. Hence, only $3$ pssibilities. Here is the updated program:



            import math
            import time

            start_time=time.time()
            def is_prime(n):
            flag=0
            if(n==2):
            return True
            if(n%2==0):
            return False
            else:
            for i in range(3,int(math.sqrt(n))+1,2):
            if(n%i==0):
            flag=1
            break
            if(flag==0):
            return True
            return False

            for i in range(1,1000):#change the number inside this braket to check for larger numbers
            c=(6*i)**3
            p=c//2-1
            if(p%7==2 or p%7==4 or p%7==6):
            if(is_prime(p) & is_prime(p+2)):
            print(p, "is such twin prime with sum",c)

            print(time.time()-start_time)





            share|cite|improve this answer











            $endgroup$



            $(3,5),(107,109)$ and $(2634011,2634013)$ are only such twin prime pairs below $10^7$. You can check for more by increasing the range using this small Python code below. I just run it upto $10^8$, $(29659499,29659501)$ and $(57395627,57395629)$ are only such pairs with $10^7<p<10^8$.




            Edit:
            For optimization purpose, I will use the fact that all primes more than $3$ can be represented in the form $6kpm 1$.



            First let check manually for $p=2,3$. For $p=2$ it's clearly not possible. For $p=3$, we have $3+5=8=2^3$, so, $(3,5)$ is such pair.



            Suppose, $p=6k-1$, with $p>5$, then we have $12k=n^3$. That means, $12|n^3$. But, as $n^3$ is a perfect cube, and we have $12=3cdot 2^2$, at least $3^3cdot 2^3=216$ will divide $n^3$. So, the pair $(108m^3-1,108m^3+1)$ will be such pair if both of them are prime.



            While dealing with cubes, usually prefer to work in $mathbbZ_7$, as any cube is either of $0,1,6$ in this field,i.e; $n^3equiv 0,1,6pmod7$ . So, we can have $2p+2equiv 0pmod7$, which gives $pequiv 6pmod7$, or, $2p+2equiv 1pmod7$ which implies $pequiv 3pmod7$ or $2p+2equiv 6pmod7$ which implies $pequiv 2pmod7$. Hence, only $3$ pssibilities. Here is the updated program:



            import math
            import time

            start_time=time.time()
            def is_prime(n):
            flag=0
            if(n==2):
            return True
            if(n%2==0):
            return False
            else:
            for i in range(3,int(math.sqrt(n))+1,2):
            if(n%i==0):
            flag=1
            break
            if(flag==0):
            return True
            return False

            for i in range(1,1000):#change the number inside this braket to check for larger numbers
            c=(6*i)**3
            p=c//2-1
            if(p%7==2 or p%7==4 or p%7==6):
            if(is_prime(p) & is_prime(p+2)):
            print(p, "is such twin prime with sum",c)

            print(time.time()-start_time)






            share|cite|improve this answer














            share|cite|improve this answer



            share|cite|improve this answer








            edited 2 days ago

























            answered Apr 4 at 10:02









            tarit goswamitarit goswami

            2,1201422




            2,1201422











            • $begingroup$
              I am not the downvoter, but my guess is that it is because your script, the substance of your answer, is quite inefficient compared to some others that were posted.
              $endgroup$
              – Mees de Vries
              Apr 4 at 14:32










            • $begingroup$
              @MeesdeVries Updated it, please have a look.
              $endgroup$
              – tarit goswami
              Apr 4 at 19:20
















            • $begingroup$
              I am not the downvoter, but my guess is that it is because your script, the substance of your answer, is quite inefficient compared to some others that were posted.
              $endgroup$
              – Mees de Vries
              Apr 4 at 14:32










            • $begingroup$
              @MeesdeVries Updated it, please have a look.
              $endgroup$
              – tarit goswami
              Apr 4 at 19:20















            $begingroup$
            I am not the downvoter, but my guess is that it is because your script, the substance of your answer, is quite inefficient compared to some others that were posted.
            $endgroup$
            – Mees de Vries
            Apr 4 at 14:32




            $begingroup$
            I am not the downvoter, but my guess is that it is because your script, the substance of your answer, is quite inefficient compared to some others that were posted.
            $endgroup$
            – Mees de Vries
            Apr 4 at 14:32












            $begingroup$
            @MeesdeVries Updated it, please have a look.
            $endgroup$
            – tarit goswami
            Apr 4 at 19:20




            $begingroup$
            @MeesdeVries Updated it, please have a look.
            $endgroup$
            – tarit goswami
            Apr 4 at 19:20











            1












            $begingroup$

            $p + (p + 2) = 2p + 2 = 2(p + 1)$



            For the sum to be a cube, $p + 1$ must be divisible by 4, so that the sum becomes $2 times 4m^3$ for some integer $m$. So $p + 1$ is of the form $4m^3$.






            share|cite|improve this answer









            $endgroup$








            • 2




              $begingroup$
              Also, with the exception of the twin prime pair 3,5, every pair of twin primes must be of the form 6n-1,6n+1. Using your notation, you can further refine based on this to $p+1=108k^3$
              $endgroup$
              – Moko19
              Apr 4 at 9:52















            1












            $begingroup$

            $p + (p + 2) = 2p + 2 = 2(p + 1)$



            For the sum to be a cube, $p + 1$ must be divisible by 4, so that the sum becomes $2 times 4m^3$ for some integer $m$. So $p + 1$ is of the form $4m^3$.






            share|cite|improve this answer









            $endgroup$








            • 2




              $begingroup$
              Also, with the exception of the twin prime pair 3,5, every pair of twin primes must be of the form 6n-1,6n+1. Using your notation, you can further refine based on this to $p+1=108k^3$
              $endgroup$
              – Moko19
              Apr 4 at 9:52













            1












            1








            1





            $begingroup$

            $p + (p + 2) = 2p + 2 = 2(p + 1)$



            For the sum to be a cube, $p + 1$ must be divisible by 4, so that the sum becomes $2 times 4m^3$ for some integer $m$. So $p + 1$ is of the form $4m^3$.






            share|cite|improve this answer









            $endgroup$



            $p + (p + 2) = 2p + 2 = 2(p + 1)$



            For the sum to be a cube, $p + 1$ must be divisible by 4, so that the sum becomes $2 times 4m^3$ for some integer $m$. So $p + 1$ is of the form $4m^3$.







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Apr 4 at 9:36









            11235813211123581321

            350210




            350210







            • 2




              $begingroup$
              Also, with the exception of the twin prime pair 3,5, every pair of twin primes must be of the form 6n-1,6n+1. Using your notation, you can further refine based on this to $p+1=108k^3$
              $endgroup$
              – Moko19
              Apr 4 at 9:52












            • 2




              $begingroup$
              Also, with the exception of the twin prime pair 3,5, every pair of twin primes must be of the form 6n-1,6n+1. Using your notation, you can further refine based on this to $p+1=108k^3$
              $endgroup$
              – Moko19
              Apr 4 at 9:52







            2




            2




            $begingroup$
            Also, with the exception of the twin prime pair 3,5, every pair of twin primes must be of the form 6n-1,6n+1. Using your notation, you can further refine based on this to $p+1=108k^3$
            $endgroup$
            – Moko19
            Apr 4 at 9:52




            $begingroup$
            Also, with the exception of the twin prime pair 3,5, every pair of twin primes must be of the form 6n-1,6n+1. Using your notation, you can further refine based on this to $p+1=108k^3$
            $endgroup$
            – Moko19
            Apr 4 at 9:52



            Popular posts from this blog

            Sum ergo cogito? 1 nng

            三茅街道4182Guuntc Dn precexpngmageondP