def getLoopSize(key, subjectNumber):
    """Reverse engineers the loop size from the given key and subject number.
    
    This is done by continually dividing the key by the subject number
    until the result matches 1.
    If the result has decimal digits 20201227 gets added to the previous
    key, before it is divided again.
    By counting the divisions the loop size can be determined.
    
    Parameters
    ----------
    key: int
        The key to get the loop size for.
    subjectNumber: int
        The subject number used to generate the key.
    
    Returns
    -------
    int
        The loop size used to generate the given key.
    """
    loopSize = 0
    while key != 1:
        newKey = key / subjectNumber
        while newKey % 1 != 0:
            key += 20201227
            newKey = key / subjectNumber

        key = newKey
        loopSize += 1

    return loopSize