30) Let the total number of rabbits initially be n and the number deposited at each house is x.
After the first house, we have n-x rabbits. We cross the bridge to double the number we have. So we now have 2n - 2x rabbits
After the second house, we have (2n - 2x) - x rabbits. We cross the bridge to double the number we have. So we now have 2(2n - 3x) = 4n - 6x rabbits
After the third house, we have (4n - 6x) - x rabbits. We cross the bridge to double the number we have. So we now have 2(4n-7x) = 8n - 14x rabbits
After the fourth house, we have (8n - 14x) - x rabbits. We cross the bridge to double the number we have. So we now have 2(8n-15x) = 16n - 30x
At the fifth house, we have (16n-30x) - x rabbits, which equals 0 as we now have no more rabbits.
So 16n - 31x = 0. To find the minimum number of rabbits required, think about this logically:
the least amount of rabbits he can leave at each house is 1. So let x = 1. If x = 1, then 16n = 31. n = 31/16. But this is not a whole number, so x cannot equal 1.
Instead of checking every single integer up, we can look at why x = 1 doesn't work -> 31 is not divisible by 16. So if we look for the least common multiple of 16 and 31, we can solve for n easily.
LCM of 31,16 = 496. Therefore we need 31x = 16n = 496 => (x = 16, n = 31)
This can be extended to any number m houses. If you look at the pattern generated on each step, the equation for the amount of rabbits is:
Where m = number of houses; n = initial number of rabbits; x = rabbits deposited at each house.