Amy and Nick, the twin siblings, are planning to hold a party in their house, so they independently call to their elementary class mates to bring the snack over.
Nick's friends, a group of boys, have brought a big bag of candies. If they are divided equally among these boys, there will be candies remaining.
On the other hand, Amy's friends, a group of girls, have also brought another big bag of candies. If they are divided equally among these girls, there will be candies remaining.
When both groups arrive at the house, they combine all the candies from both bags into one big bowl, which Amy and Nick have arranged. If all the candies are divided equally among all these children, there will be only candies remaining. Moreover, the total candies they have are of the least possible amount satisfying all these constraints.
Initially, what is the difference of the candies in both bags?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Let x be the amount of candies in the boys' bag and y be that in the girls' bag. We can set up the modular equivalences, as followed:
x ≡ 4 ( m o d 7 ) y ≡ 5 ( m o d 8 ) x + y ≡ 2 ( m o d 1 7 )
Alternatively, we can rewrite x = 7 p + 4 and y = 8 q + 5 for some non-negative integers p , q . Then there are three scenarios for these quotients p , q .
First of all, if p = q , the modular equivalence will be, as followed:
x + y ≡ 1 5 p + 4 + 5 ≡ 2 ( m o d 1 7 ) 7 ≡ 2 p ( m o d 1 7 )
Since 2 × 9 ≡ 1 ( m o d 1 7 ) , the modular inverse of 2 is 9 per modulo 1 7 .
9 × 2 p ≡ p ≡ 9 × 7 ≡ 6 3 ≡ 1 2 ( m o d 1 7 )
Because p is non-negative, the minimal value of p = q is 1 2 . This results in x = 7 × 1 2 + 4 = 8 8 and y = 8 × 1 2 + 5 = 1 0 1 . The total is 8 8 + 1 0 1 = 1 8 9 .
Now we will examine the other scenarios.
Second, if p > q , then we can set up p = q + n for some positive integer n , and the modular equivalence will be, as followed:
x + y ≡ 1 5 q + 7 n + 9 ≡ 2 ( m o d 1 7 ) 7 n + 7 ≡ 2 q ( m o d 1 7 ) 2 q ≡ 7 ( n + 1 ) ( m o d 1 7 ) 9 × 2 q ≡ q ≡ 6 3 ( n + 1 ) ≡ − 5 ( n + 1 ) ( m o d 1 7 ) q + 5 ( n + 1 ) ≡ 0 ( m o d 1 7 )
In order to yield the least possible values of x , y , the resulting number must be 1 7 , the least positive multiple. That is 5 ( n + 1 ) + q = 1 7 .
Clearly, the number 5 acts as a divisor with n + 1 as the quotient and q as the remainder. Therefore, n + 1 = 3 ; n = 2 ; q = 2 . That will lead to p = q + n = 4 . Then x = 7 × 4 + 4 = 3 2 and y = 8 × 2 + 5 = 2 1 . The total is 3 2 + 2 1 = 5 3 .
Definitely, the first scenario fails to be the least values, and so we move on to the last scenario.
If q > p , then we can set up q = p + m for some positive integer m , and the modular equivalence will be, as followed:
x + y ≡ 1 5 p + 8 m + 9 ≡ 2 ( m o d 1 7 ) 7 ≡ 2 p − 8 m ( m o d 1 7 ) 7 ≡ 2 ( p − 4 m ) ( m o d 1 7 ) 9 × 7 ≡ 1 2 ≡ p − 4 m ( m o d 1 7 ) 4 ( m + 3 ) − p ≡ 0 ( m o d 1 7 )
Similarly, as previously explained, 4 ( m + 3 ) − p = 1 7 although this time, the remainder is of negative value, so we just need to find the least multiple of 4 that exceeds 1 7 . That is obviously 2 0 . Then it is not brutal to calculate that 4 × 5 − 3 = 1 7 . Thus, m + 3 = 5 ; m = 2 ; and p = 3 . That lead to q = 3 + 2 = 5 . Then x = 7 × 3 + 4 = 2 5 and y = 8 × 5 + 5 = 4 5 . The total is 2 5 + 4 5 = 7 0 .
Again, the last scenario also fails to satisfy, making the second scenario the desired solution. Finally, the difference between the candies in both bags equals 3 2 − 2 1 = 1 1 .