Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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