Skip to content

Instantly share code, notes, and snippets.

@eliannelavoie
Last active April 17, 2018 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliannelavoie/ed400a19b180b07f19b994fade0908e4 to your computer and use it in GitHub Desktop.
Save eliannelavoie/ed400a19b180b07f19b994fade0908e4 to your computer and use it in GitHub Desktop.
from math import sqrt
from itertools import combinations
def isP(n):
return (1/6*(sqrt(24*n+1)+1)).is_integer()
p = [n*(3*n-1)/2 for n in range(1,2500)]
for x in combinations(p, 2):
if (isP(x[0]+x[1]) and isP(x[1]-x[0])):
print(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment