This question has already been answered:

It is necessary to find the number of dividers of an n-digit number (n> 20). How to implement it?

Reported as a duplicate by the participants pavel , gbg , Denis , Anton Shchyrov , Vlad from Moscow on 22 Nov '16 at 13:58 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Using long arithmetic. - Harry
  • In general, no way. Especially when n is very large. - Zealint
  • @Harry, can I have an algorithm? I watched a long arithmetic for division, but it is not clear, since we divide by a bar. But if you look for the number of divisors of a twenty - figured number in this way, the program will take a very long time to work - IWProgrammer
  • And in another way so far. If it were possible to quickly allocate very large numbers to factors, then RSA encryption would immediately order you to live a long time ... You give at least some restrictions on top - and then who knows, maybe you have a million numbers in total ... - Harry

1 answer 1

1 You can study long arithmetic. For example, here or here .

2 You can use ready-made long arithmetic. For example, MPIR or GMP

Well, and then doing a bust on all simple numbers, in the hope that it will work quickly. In the worst case, it will work ... several billion years.

UPD: 235910232262849857961 way, this is a random 21-digit prime number to check for 235910232262849857961