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 made it
i<n/2
for less tests but i guess your solution is the best practice. Thanks for letting us know.The Wikipedia article on trial division has an explanation. Once you've done it a couple of times, it becomes second nature. There are a lot of kata on primes ..
Doing a multiplication is cheaper than taking a square root.
This comment is hidden because it contains spoiler information about the solution
thanks for the input =)
Quadratically too many tests, but let's vote it Best Practice.
People will vote anything Best Practice ..
The
for
test should bei*i <= n
.