You are viewing a single comment's thread. Return to all comments →
from math import sqrt :
def ispentagonal(a) :
if a <= 0 : return False delt = 1 + 24 * a x1 = (1 - sqrt(delt)) / 6 x2 = (1 + sqrt(delt)) / 6 if x1 > 0 and x1.is_integer(): return True if x2 > 0 and x2.is_integer(): return True
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #44: Pentagon numbers
You are viewing a single comment's thread. Return to all comments →
from math import sqrt :
def ispentagonal(a) :