Project Euler #129: Repunit divisibility

Sort by

recency

|

23 Discussions

|

  • + 0 comments

    I have tried using hashmaps but still getting the timeout error. Can some one explain why?

  • + 0 comments

    PHP brute force:

    while (((pow(10,$k)-1)/9) % $n !== 0) {
        $k++;
    }
    

    Divide all the repunits until one works.

  • + 0 comments

    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.

  • + 0 comments

    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.

  • + 0 comments

    check my code. Its working awesome https://codeshare.io/P4FZd