Time Limit Exceeded(tle)

Unable to figure out how to overcome tle in test case 2

Hi, please share the code.

Code is in collaboration mode

I don’t get you, but anyway I retrieved the solution from your recent submissions.

Please note that the value of n can be 2,147,483,647, and your code has a time complexity of O(n*sqrt(n)). It will definitely exceed the TL.

The better way to do this is to first find all the prime factors of n in O(sqrt(n)) and then check the sum of digits thing.