Ejemplo n.º 1
0
def isPentagonal(n):
    soln = quad_formula(3, -1, -2*n)
    if soln[0] > 0 and soln[0] == int(soln[0]) or soln[1] > 0 and soln[1] == int(soln[1]):
        return True
    else:
        return False
Ejemplo n.º 2
0
def isHexagonal(n):
    soln = quad_formula(2, -1, -n)
    if soln[0] > 0 and soln[0] == int(soln[0]) or soln[1] > 0 and soln[1] == int(soln[1]):
        return True
    else:
        return False
Ejemplo n.º 3
0
def isTriangular(n):
    soln = quad_formula(1, 1, -2*n)
    if soln[0] > 0 and soln[0] == int(soln[0]) or soln[1] > 0 and soln[1] == int(soln[1]):
        return True
    else:
        return False