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 just want to point out that:
bits.replaceAll("^0+", "").replaceAll("0+$", "");
Can be shortened to: bits.replaceAll("^0+|0+$", "").
The "or" operator is a handy sign~
Nice one :)
As a little improvements :
In the "finder" method, you might be checking multiple times the same number to know if it is a prime number or not.
Example : gap(6, 2, 20), you will check 2 and 8 (x = 2), then 3 and 9 (x = 3), then 4 (x = 4), then 5 and 11 plus 6 and 7 (between 5 and 11 until a prime is found) (x = 5), then 6 (x = 6), then 7 and 13 (x = 7), etc. In that example, 6 and 7 have already been checked twice.