I am using the following code to calculate the number of Divisor of a large number(10^16 order). Code Link:- https://ideone.com/eBnZ37 (The output for 11 should be 2 whereas it’s giving me 4).

This implementation was provided here:- https://discuss.codechef.com/questions/96880/calculate-number-of-factors-of-a-large-number?page=1#96889. by @adhish_kapoor

It uses Sieve, Miller Rabin and finally calculates no of factors in O(N^1/3) using this algorithm :- http://codeforces.com/blog/entry/22317 .

However I am getting a wrong output. Can someone please help me in figuring out what is wrong with this code?