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

# | User | Rating |
---|---|---|

1 | tourist | 3496 |

2 | moejy0viiiiiv | 3288 |

3 | W4yneb0t | 3218 |

4 | TakanashiRikka | 3178 |

5 | Petr | 3173 |

6 | dotorya | 3117 |

7 | izrak | 3109 |

7 | Um_nik | 3109 |

9 | anta | 3106 |

10 | ershov.stanislav | 3105 |

# | User | Contrib. |
---|---|---|

1 | rng_58 | 175 |

2 | csacademy | 169 |

3 | Swistakk | 160 |

4 | tourist | 157 |

4 | Petr | 157 |

6 | Errichto | 154 |

7 | Zlobober | 147 |

8 | matthew99 | 142 |

9 | Endagorion | 141 |

10 | BledDest | 134 |

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

↑

↓

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Nov/21/2017 00:00:24 (c4).

Desktop version, switch to mobile version.

User lists

Name |
---|

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.

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!!

thanks i got it...yeah there have some mistake.. for large number it's quite impossible there is no exact solution for this ques with 9 sec :) thank you :)

Well imho there is something more exact, but this is a lesser pain ^_^

Also the probability is "soo big" you can treat is as exact :)

Have nice day ^_^