Блог пользователя YoyOyoYOy000y000

Автор YoyOyoYOy000y000, история, 9 лет назад, По-английски

hi, i think all of divisors of n(1 to 10^18) with in 9 sec is quit immpossible. if any idea or solution.please share it :) thank you

  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Iterating from 1 to sqrt(n) and using divisor pairs will give you the answer. In 9 secs, I think you can do 10^9 operations, even with the constant of the modulo operation.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Good day to you,

well firstly you can start with "Pollard Rho" (you will also need something like miller-rabin), which could factorize the number in O(N^(1/4)) [it is somehow long coding with many possible mistakes, but the core is not that bad].

As you have it, you can generate all divisors by "simple recursion" in O(#NUMBER_OF_DIVISORS)

Hope I guessed rightly what you asked for ^_^

Good Luck & Have nice day!!