Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Are you sure you get invalid answers with this code on CW? I ran it several times and all I got were timeouts, and not a single wrong answer.
Also you could work on your factoriazation method a bit. It first goes through the number too many times, and then unneccessarily scans the collection of factors many times. These operations can be reduced significantly to, more or less, one loop over the part of the number, and eventually one loop over the collected factors.
Then you have to show us your code, I think it will be the easiest way to find your mistake. Remember about formatting and spoiler flag.
You should check if your solution works good when run twice in a row, for two or more test cases run one after another.