0

Seven pirates attacked the British ship and loot some rare gems from them. They decided to rest for some time and then divide the gems later. While everyone was resting two of the pirates wake up and planned to divide gems equally between the two, one gem is left. So they decide to wake the third pirate and decide to divide among three, but alas again one gem was left. They then decide to wake the fourth pirate to divide the gems and again one gem was left. The same happened again in the fifth and sixth. Finally, they woke up the 7th pirate and this time the gems were divided equally. How many gems did they steal in total?

How would you solve this without just plugging in multiples and seeing which works? I know you can use the LCM of {2-6} and streamline it by doing something such as (60x+1)/7 = 0, but is there a way to find a formula that will answer the question, without any plugging? Thank you!

Bill Dubuque
  • 282,220

2 Answers2

0

Yes there is. Your problem can be encoded as a system of equations with modulus. Your case in particular is encoded as

$$\begin {cases}x \equiv 1\ mod\ 2\\ x \equiv 1\ mod\ 3\\ x \equiv 1\ mod\ 4\\ x \equiv 1\ mod\ 5\\ x \equiv 1\ mod\ 6\\ x \equiv 0\ mod\ 7\end {cases}$$

Where $x $ is the number of gems.

These systems can be solved with the Chinese Remainder Theorem. You may want to google that up.

RGS
  • 9,883
0

We just need a number of the form $7k$ that is congruent to $1\bmod 60$.

So we have to find the inverse of $7\bmod 60$, we can use the extended euclidean algorithm:

$60=7\times 8 +4$

$7=4+3$

$4=3+1$

We conclude $1=4-3=4-(7-4)=2\times 4 -7=2\times(60-7\times 8)-7=2\times 60-17\times 7$.

So the inverse of $7\bmod 60$ is $-17$.

Hence the number is of the form $7(60j-17)$, the smallest positive option is when $j=1$ and you get $7\times 43=301$

Asinomás
  • 107,565
  • another (simpler way) was to note that you wanted $60j+1$ to be a multiple of $7$ and so you jeeded $60j\equiv -1 \bmod $. since the inverse of $60\bmod 7$ is clearly $2$ you need $j=7k-2$ and so the solution is $60(7k-2)+1$ which is minimized when $k=1$. – Asinomás Jan 11 '17 at 00:02