Frobenius Number #
In this file we first define a predicate for Frobenius numbers, then solve the 2-variable variant of this problem. We also show the Frobenius number exists for any set of coprime natural numbers that doesn't contain 1. This is closely related to the fact that all ideals of ℕ are finitely generated, which we also prove in this file.
Theorem Statement #
Given a finite set of relatively prime integers all greater than 1, their Frobenius number is the
largest positive integer that cannot be expressed as a sum of nonnegative multiples of these
integers. Here we show the Frobenius number of two relatively prime integers m
and n
greater
than 1 is m * n - m - n
. This result is also known as the Chicken McNugget Theorem.
Implementation Notes #
First we define Frobenius numbers in general using IsGreatest
and AddSubmonoid.closure
. Then
we proceed to compute the Frobenius number of m
and n
.
For the upper bound, we begin with an auxiliary lemma showing m * n
is not attainable, then show
m * n - m - n
is not attainable. Then for the construction, we create a k_1
which is k mod n
and 0 mod m
, then show it is at most k
. Then k_1
is a multiple of m
, so (k-k_1)
is a multiple of n, and we're done.
Tags #
frobenius number, chicken mcnugget, chinese remainder theorem, AddSubmonoid.closure
A natural number n
is the Frobenius number of a set of natural numbers s
if it is an
upper bound on the complement of the additive submonoid generated by s
.
In other words, it is the largest number that cannot be expressed as a sum of numbers in s
.
Equations
- FrobeniusNumber n s = IsGreatest {k : ℕ | k ∉ AddSubmonoid.closure s} n
Instances For
The gcd of a set of natural numbers is defined to be the nonnegative generator
of the ideal of ℤ
generated by them.
Equations
Instances For
The characterizing property of Nat.setGcd
.
ℕ
is a Noetherian ℕ
-module, i.e., ℕ
is a Noetherian semiring.
A set of natural numbers has a Frobenius number iff their gcd is 1; if 1 is in the set, the Frobenius number is -1, so the Frobenius number doesn't exist as a natural number. Wikipedia seems to attribute this to Issai Schur, but Schur's theorem is a more precise statement about asymptotics of the number of ℕ-linear combinations, and the existence of the Frobenius number for a set with gcd 1 is probably well known before that.