|
|
|
|
|
by fortenforge
912 days ago
|
|
The author mentions at one point that he was unable to solve a problem because he didn't memorize the formula for the Euler totient function in order to count the number of numbers relatively prime to 9999. ...but its actually an interesting (and not super difficult) exercise in its own right to figure this out even if you don't know the formula. Encourage you all to give it a shot. SPOILERS: 9999 = 3^2 * 11 * 101, so first subtract out the multiples of 3 (3333 of them), the multiples of 11 (909 of them), the multiples of 101 (99 of them). Note that we've now double-subtracted multiples of 33 (303 of them), multiples of 303 (33 of them), multiples of 1111 (9 of them) so add these back. Finally subtract 1 to not count 9999 itself. phi(9999) = 9999 - 3333 - 909 - 101 + 33 + 303 + 9 - 1 = 6000 I guess my point is that the purpose of these problems is not to separate out people who know specific tricks from people who don't—its to separate out people who can reason their way through difficult mathematical problems and people who can't. |
|
Trying to come up with everything from scratch could take a lot longer and be very frustrating when you've got other problems waiting for you to solve.