def carmichael() -> Iterator[int]:
    """Composite numbers n such that a^(n-1) == 1 (mod n) for every a coprime
    to n.
    https://oeis.org/A002997
    """
    for m in composite():
        for a in range(2, m):
            if pow(a, m, m) != a:
                break
        else:
            yield m