Quiz - Help the King to get the count of Mangos
Question:
A poor fruit seller has lost his one basket of mangos and he reported this to the king. The king asked him how many mangos are in the basket. He replied him saying that he does not the know exact number but he knows the count in another way.
He continued that the actual count will give you
the remainder as 8 when divided by 9,
the remainder as 7 when divided by 8,
the remainder as 6 when divided by 7,
the remainder as 5 when divided by 6,
the remainder as 4 when divided by 5,
the remainder as 3 when divided by 4,
the remainder as 2 when divided by 3 and
the remainder as 1 when divided by 2.
Can you help to king to get the count of mangos?
Answer:
Take the LCM (Least Common Multiple) for 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 = 2520.
Then subtract -1 = 2519
2519 % 10 = 9
2519 % 9 = 8
2519 % 8 = 7
2519 % 7 = 6
2519 % 6 = 5
2519 % 5 = 4
2519 % 4 = 3
2519 % 3 = 2
2519 % 2 = 1
|