Unable to understand what is wrong in my code

I am not able to pass 2 test cases

Hey @gargayush34
You’re calculating primes till only 10^6. But max value of N is upto 2,147,483,647. So modify your approach accordingly.

If your doubt is resolved please mark it as closed.

how can I run till that value…Wont I get TLE

I think if I run till 10^6 for seive, I will cover all the primes that I need to cover

what should I do…

I have updated my code to handle large numbers by taking into account that factors array will be empty… What am I doing wrong now?


Check this out. There is actually one more condition, you need to add sum of digits of prime numbers in factorisation and not prime factors themselves.

If your doubt is resolved please mark it as closed.