Book VII · Proposition 32

VII.32

Any number either is prime or is measured by some prime number.Heath, 1908

Every step, checked

What it needs, and what needs it

Needs: VII.31

Rests on: Def.VII.3

Depth: 1 steps of argument above the first principles. Parallel postulate: not needed.

What it takes on trust

Nothing. It draws no intersections and reads nothing off the picture.

The proposition as code

@proposition(
    "VII.32",
    THEOREM,
    sample=lambda rng: (rng.randint(2, 500),),
)
def prop_VII_32(n: int) -> Out:
    hypothesis("the number is greater than a unit", n > 1, guard=True)
    factors = prime_factors(n)
    because(prop_VII_31, n) if n > 3 and not is_prime(n) else None

    claim("the number is prime, or some prime measures it", "VII.31",
          is_prime(n) or (bool(factors) and is_prime(factors[0])
                          and measures(factors[0], n)))
    return Out(prime=factors[0])