Fermat prime Created 2026-09-24 Updated 2026-10-14
A Fermat prime is a Fermat number that is also a prime number:
The defining form alone does not imply primality. For example, is a Fermat prime, while is a Fermat number with proper divisors. For , every Fermat prime is one modulo four and two modulo three. Pépin's test gives an exact primality testing criterion for these candidates, rather than relying on their form.
The passage belongs to the English reception of Euclid's number theory. Henry Billingsley's The Elements of Geometrie by Henry Billingsley, published in 1570, brought the Elements into English with extensive explanatory material. The original title page advertises translation and annotations; the extract's worked examples show what explanatory prose could add to a compact definition. Henry Billingsley's numbering calls this Definition 23 of Book VII; the familiar modern numbering is VII, Definition 22. The difference is editorial, not a difference in the perfect number being defined.[ref][ref]
Here a number's parts are its positive proper divisors, rather than arbitrary pieces of a sum or all smaller integers. In modern notation the definition is
where is the sum-of-divisors function. Thus is not a perfect number: its positive proper divisors total . It is essential to exclude itself: including it would double the required sum. The pairing of a divisor with the fraction of the whole explains the extract's language of halves, thirds and so on. Its examples are complete checks because they identify every positive proper divisor, not merely some convenient decomposition.
The larger mathematical context is the construction in Book IX, Proposition 36. If is a prime number, then is a perfect number. To reconstruct the argument, prime factorization gives all its divisors as and , with . A finite geometric series therefore gives
The choices produce . The primality assumption matters: choosing produces , whose sum-of-divisors function is , not . The construction gives a reason for the examples and connects perfect numbers with Mersenne primes.[ref]
The extract itself supplies a definition and examples, not a classification or a mathematical proof that such numbers are rare. In particular, the converse that every even perfect number has this form belongs to the later Euclid-Euler theorem; it should not be read back into this passage. The historically significant feature is the transmission of deductive arithmetic through vernacular explanation: a book called geometry also teaches the divisibility theory needed for a general construction.
It performs a trial division test for a prime number. An integer below is rejected; otherwise the function searches for a divisor from through . A composite number has a prime factor no larger than its square root, so finding no such divisor proves primality. For example, mystery2(97) returns True, while mystery2(91) returns False, since .
This describes the intended mathematical test. For extremely large integers, the floating-point computation n**0.5 can round or overflow; an implementation intended for arbitrary-size integers should use an exact integer square root.
Primality Created 2026-10-14 Updated 2026-10-20
Primality is the property of a positive integer being a prime number. Primality testing determines this property; integer factorization asks for factors and is a different computational task.
Prime-valued sum 2026-10-20
A sum whose resulting value is a prime number. This is a condition on the value, rather than a requirement that the summation index run over prime numbers. Counting subsets with a prime-valued sum can use subset sum counts followed by a primality filter on the possible totals.