from typing import Tuple


def factor(n) -> Tuple[int, int]:
    """
    Solve for s, d where n - 1 = 2^s * d

    :param n: an integer being tested for primality
    :return: s, d
    """
    s = 0
    d = n - 1

    while d % 2 == 0:
        s += 1
        d //= 2

    return s, d