# The Egg Remainder Problem

by Seth Tyler May 31, 2011

The Egg Remainder Story
There is a story of a man selling eggs from his stall in a market. The story asks the listener to determine the number of eggs the man has if it is known that when the eggs are arranged in rows of threes there remains one egg in a row of its own. When the eggs are arranged in rows of ﬁves, then two eggs are left in a row of their own. Finally, when the eggs are arranged in rows of sevens, there are three eggs left in a row of their own. To solve this problem we will borrow some knowledge from a branch of mathematics called modular arithmetic. Modular arithmetic is simply a way of talking about remainders and the algebra that governs them.

First some notation
We say that a number a is congruent to a number b modulo m if the number m divides (a − b). In other words, the quantity (a − b) is a multiple of m. When this is true we may write the following congruence statement. a ≡ b (mod m) The above statement is read, “a is congruent to b modulo m”. Observe, that the above statement can be interpreted to mean that when a is divided by m it leaves a remainder of b. Hence, since the egg problem is about remainders, it is also about congruences.

The Egg Remainder Problem
A certain number of eggs when arranged in rows of threes leaves one egg on a row of its own, while an arrangement in rows of ﬁves leaves two eggs in a row of their own and

1

then a ± c ≡ b ± d (mod m). 35n ≡ 35 21n ≡ 42 15n ≡ 45 (mod 105) (mod 105) (mod 105) multiplying through by 35 multiplying through by 21 multiplying through by 15 (1) (2) (3) The above congruences come from the property that if a ≡ b (mod m). to show a ± c ≡ b ± d (mod m) we must ﬁnd an k ∈ Z such that a ± c = mk + (b ± d). Now we use the following property. 3×5×7 = 105 will be our modulus.g. 17 ≡ 3 (mod 7) since 17 = 7 × 2 + 3.with an arrangement in rows of sevens leaves three eggs in a row of their own. The task to the above scenario is to determine the minimal number of eggs with such properties. then ak ≡ bk (mod mk). 5 and 7. THEOREM If a ≡ b (mod m) and c ≡ d (mod m). n≡1 n≡2 n≡3 (mod 3) (mod 5) (mod 7) In order to work more eﬃciently with the above congruences we desire a common modulus. It is reasonable to take the least common multiple of 3. Hence. 2 . Hence. e. The Egg Remainder Problem in Terms of Congruences The problem may be written using conventions of modular arithmetic. Thus. PROOF First note that a ≡ b (mod m) if and only if there exists k ∈ Z such that a = mk + b.

Therefore. q ∈ Z. Let’s just check this works. then we have n = 52 eggs. Thus. c = mq + d for some p. Related Problems 1. 52 = 3 × 17 + 1 52 = 5 × 10 + 2 52 = 7 × 7 + 3 Since 52 is the ﬁrst number to have a remainder of 52 when divided by 105.Given a ≡ b (mod m) and c ≡ d (mod m) we may write a = mp + b. The above theorem allows us to add and subtract congruences with the same modulus. from our earlier congruences we get (1) − (3) ⇒ (2) − (4) ⇒ 20n ≡ −10 n ≡ 52 (mod 105) (mod 105) (4) (5) This last congruence solves the problem. 2 and 3 when divided by 3. Adding the above equations together produces a ± c = mp + b ± (mq + d) = m(p ± q) + (b ± d) Letting k = p ± q we have a ± c = mk + (b ± d) as desired. Solve the egg remainder problem but this time there are left 2. Because this congruence was obtained from our original three congruences.E.D. 3 and 4 eggs when arranged in rows of 5. a ± c ≡ b ± d (mod m) Q. 5 and 7 respectively. 3 . 7 and 9 respectively. we are certain that 52 leaves remainder 1. It says that n has a remainder of 52 when divided by 105.

Let’s verify. 3 and 4 eggs when arranged in rows of 3. 7 and 11. 157 = 5 × 31 + 2 157 = 7 × 22 + 3 157 = 9 × 17 + 4 2. n = 157 . respectively. Solution 4 . 2.Solution n≡2 n≡3 n≡4 (mod 5) (mod 7) (mod 9) 5 × 7 × 9 = 315 63n ≡ 126 45n ≡ 135 35n ≡ 140 (mod 315) (mod 315) (mod 315) (6) (7) (8) 10n ≡ −5 18n ≡ −9 28n ≡ −14 (mod 315) (mod 315) (mod 315) (9) (10) (11) 46n ≡ −23 (mod 315) (mod 315) (12) (13) n ≡ −158 ≡ 157 Hence. Solve the egg remainder problem but this time there are left 1. 5.

11n ≡ 572 10n ≡ 205 n ≡ 367 (mod 1155) (mod 1155) (mod 1155) (22) (23) (24) 367 = 3 × 122 + 1 367 = 5 × 73 + 2 367 = 7 × 52 + 3 367 = 11 × 33 + 4 5 .n≡1 n≡2 n≡3 n≡4 3 × 5 × 7 × 11 = 1155 (mod 3) (mod 5) (mod 7) (mod 11) (14) (15) (16) (17) 385n ≡ 385 231n ≡ 462 165n ≡ 495 105n ≡ 420 (mod 1155) (mod 1155) (mod 1155) (mod 1155) (18) (19) (20) (21) (20) − [(18) − (19)] ⇒ (18) − (20) − 2 × (21) ⇒ (22) − (24) ⇒ Hence. n = 367 . Let’s verify this.