What is the least number which, when divided by 12, 15, 20 and 54, leaves a remainder of 8 in each case?
548. The number minus 8 must be a multiple of all four divisors. LCM(12, 15, 20, 54) = 540, so the least such number is 540 + 8 = 548.
Explain it simply
If you pack a box of laddoos into rows of 12, 15, 20 or 54 and every time exactly 8 are left over, then removing those 8 leaves a pile that fits every row size perfectly. The smallest pile that fits all row sizes is the LCM. Add the 8 back and you have the answer.
Example
Question: Least number that leaves remainder 8 when divided by 12, 15, 20 and 54.
- Factorise: 12 = 2^2 x 3, 15 = 3 x 5, 20 = 2^2 x 5, 54 = 2 x 3^3.
- LCM = 2^2 x 3^3 x 5 = 4 x 27 x 5 = 540.
- Answer = 540 + 8 = 548.
Check: 548 = 12 x 45 + 8 = 15 x 36 + 8 = 20 x 27 + 8 = 54 x 10 + 8.
console.log([12, 15, 20, 54].map(d => 548 % d)); // Output: [8,8,8,8]A variation: if the remainders differ but each is the same amount short of its divisor (for example 12 leaves 4, 15 leaves 7), the number is LCM minus that shortfall, here 540 - 8 = 532.
What to say in the interview
"Same remainder for every divisor means the number is LCM plus that remainder. The LCM of 12, 15, 20 and 54 is 540, so the least number is 548."
Common mistakes
- Taking HCF instead of LCM.
- Taking the highest power of only some primes; 54 brings 3^3, which is easy to miss.