could you please check where the problem is … i think the logic is correct
Playing with divisors is fun
@imavneet why are you checking is count is even or odd?
and you are not taking modulo properly. The product count*arr[i] will always be even.
ans = (ans*(((arr[i]*count)/2)%mod +1) )%mod.
Take modulo on doing every multiplication or addition.
If this resolves your doubt mark it as resolved
@Abhinav2604 sir i tried this method … 2 more cases have passed but 3 are still incorrect …
the range of powers of prime is also pretty large so how to overcome that and count the divisors of actual number?
@imavneet hey one thing, when we are taking modulo, then division should not be done, instead we should take the inverse modulo of denominator and multiply it with the numerator, inverse modulo of 2 under 1e7 + 2 would be 5000004.
Here have a look at this code.
If this resolves your doubt mark it as resolved.