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.
I agree with everything above, but there is another problem.
-prefer performance over making your life easy or making your code shorter
A stream in this case is much slower than prime factorization followed by permutation. During my tests, the stream solution (even using n/2) takes about 80 milliseconds for 1-250. Prime factorization and permutation takes 2. When you bump the range up to 1-24000 it's 4100ms for streams and 150ms for prime factorization and permutation. Don't use a tool when it's inappropriate to do so.
This comment is hidden because it contains spoiler information about the solution