def findCyclePeriod(p):
    """Given prime number p, find the period of the cycle for 1/p"""
    if p == 2 or p == 5:
        return 0
    period = 2
    while True:
        if pow(10, period - 1, p) == 1:
            return period - 1
        period += 1