We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #129: Repunit divisibility
Project Euler #129: Repunit divisibility
Sort by
recency
|
23 Discussions
|
Please Login in order to post a comment
I have tried using hashmaps but still getting the timeout error. Can some one explain why?
PHP brute force:
Divide all the repunits until one works.
I have to say that it was a really challenging one. Some suggestions if you feel stuck like me several times trying to solve it.
Try to solved it using Euler's totient funtion: look for the smallest divisor, d, of phi(9n) such that 10^d is equiv to 1 under (mod 9n).
phi, divisors, and 10^d mod 9n, should be implemented as efficient as possible.
I am able to test most of the case in http://stdkmd.com/nrr/repunit/. However, I still can't pass the submissin. Not sure any special case I have miseed.
check my code. Its working awesome https://codeshare.io/P4FZd