January 11th, 2015, 12:42 pm
QuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: billypilgrimQuoteOriginally posted by: bluetrinQuoteOriginally posted by: billypilgrim2^29 has nine different digits. Which is the missing one?Can you give a clue ? I am far from being as good as the other people in this thread I have seen the solution, but haven't done it myself. The solution uses the fact that the difference between a number and the sum of it's digits is always divisible by 9. But looking at the solution, it's not something I can think of in an interview. May be someone else has a better method. I was guessing 7 since 7 doesn't appear till as far as 2^13, but that's not the correct answer.That description of the solution obscures it. Another way to put it is mod(x,9) = mod(sum_of_digits(x),9) and, by the distributive property of arithmetic, mod(c*x,9) = mod(2*mod(x,9),9)The pattern for mod(2^i,9) for i = 1 to 29 is: 2,4,8,7,5,1, 2,4,8,7,5,1, 2,4,8,7,5,1, 2,4,8,7,5,1, 2,4,8,7,5. The sum of digits 0 through 9 is 36, mod(36,9) = 0 which is what the answer would be if 2^29 had one copy each of all ten digits. The only way to get mod(sum_of_digits(2^29),9) = 5 using all but one of the digits is if the "4" is missing.A quick check on a pocket calculator shows 2^29 = 536870912, verifying the result.Cool. This seems better. Thanks.
Last edited by
billypilgrim on January 10th, 2015, 11:00 pm, edited 1 time in total.