mardi 2 août 2016

Java : finding the total number of divisors for a very large number in an efficient way

the number is n = 2747502308387844992 count = 0 Normal ways like using for loop is not working.

for(i=1;i<n;i++)
{
    if(n%i == 0 ){count++;}
}
System.out.println(count%(Math.pow(10,9)+7));

output to be printed is 10240. suggest me the other way which is effiecient. Please try the solution in IDE before putting here.

Aucun commentaire:

Enregistrer un commentaire