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.
Yes it's not a massive gain anyway, as the first check itteration for an even number will show it's non-prime.
Hi, I think you should be able to avoid testing even numbers by changing the last part of your code to
else get_prime(n+2)
Cheers, they've been approved!
Ah yes I see what you mean. That's a fairly common test case. Don't forget you can always perform some debugging by logging the input:
If you're ever not sure what's happening in a test, that can help!
Nice - I think this is the "code-golf" champion!
Interesting.
Just one question: why are you incrementing
x
? As "post increment"x++
has no effect as the result is still justx
.Hi. The initial solution shows uses an array function, but you are free to define the function anyway you like. For exxample, all of the following declarations of
arr
are equivalent for the purposes of this kata:You can use whichever of the above styles you feel most comfortable with.
To clear up the confusion about the return, in an arrow function (or lambda), the return is just whatever follows the arrow. So in the example solution, the return is a blank array
[]
. Here are some more examples:I hope that stirs you in the right direction.
Yes, good point, I can add a note for this.
Yes. I thought I'd made that clear with the description and examples, but I'm open to suggestions for improvements.
My intention is to create a follow up that builds on this
I think the explanation of the format part could have been clearer, so I've added an example, which also happens to be similar to the random tests
Thanks for your feedback. Hopefully they're working now, please try again...
Is there a way to run the example tests? I can only seem to run the main ones.
Your tests don't complete in time! Please refactor your "random test" suite.
If the tests time out they are anything but fine!
Even a simple function like the following doesn't complete in the alotted 12 seconds...
So anyone trying the kata can't even debug the tests.
What about subdomains? I.e. in the URL:
http://sub-domain.domain.com/path?query=string
Loading more items...