The maximum limit should be increased. Brute force solution in Java does not time out at 100000, but does time out at 1000000. I suggest to set the limit even higher, to 10000000 or something.

Go java. To see a brute force solution that doesnâ€™t time out, please visit my solution.

To be fair, sd23152243 brute forced it first successfully according to the solution history in java at least.

I use Python3â€¦

The last case always timeoutâ€¦ The greatest value of N that runs for me is 12760

N>=12761 â†’ Timeoutâ€¦

Is this an optimisation work or the IDE will not support more than that

cc @nicola

This means your algo is not optimal. You need to find a better algorithm.

Your algorithm is too slow.

Find another one.

Iâ€™ve used brute force in C (but no factorization) and doesnâ€™t timeout until the maximum result representable as a int64 (wich is for n = 100889). However it *does* time out for n = 117739.

I confess I wasnâ€™t able to disvover the trick . Iâ€™m going to check otherâ€™s solutions.

Increase the limit. You can easily brute force by checking only upto sqrt of a number to find all factors.

Hello guys. I was working on this puzzle today. I thought I found a good solution, giving me the sum in a quick time, but when it get to the last test, I get â€ś-1927827902â€ť as a result. No â€śtimeout errorâ€ť. Any idea why?

Python code worked fine but this time itâ€™s in C# and this error occurs.

Because your int is not long enough in C#.

Damn, it was as simple as using long instead of intâ€¦I feel so dumb ! Thanks nicola1 !

when you know the trick the solution can be written in one line

even with a slow language like ruby i got the corrent answer for 18562354 : 283390055742558