import math


def is_polygonal_number(m, n):
    """
        Checks whether a given number m is a polygonal number for some n, i.e.
        whether it is an n-gonal number for some n > 2. If so, it returns the
        index of the number in the sequence, otherwise it returns null.
    """
    if m == 1:
        return True
    k = (((n - 4) + math.sqrt((n - 4) ** 2 + 8 * m * (n - 2))) / (2 * (n - 2)))
    return int(k) if k.is_integer() else False