Skip to content

Instantly share code, notes, and snippets.

@eliannelavoie
Created 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/3d32698f36ee7cf45126ec170cb6d88b to your computer and use it in GitHub Desktop.
Save eliannelavoie/3d32698f36ee7cf45126ec170cb6d88b to your computer and use it in GitHub Desktop.
from math import sqrt
def isPentagonal(n):
return (1/6*(sqrt(24*n+1)+1)).is_integer()
i = 40756
while True:
h = i*(2*i-1)
if (isPentagonal(h)):
print(h)
break;
i+=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment