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.
fixed in OP's fork
Approved
python new test framework is required. updated in this fork
Python :
Javascript reference solution is too slow to use the same range. Maybe it should be rewritten.
Yes. I solved that kata. I looked my old solution and I solved this kata. I forgetted How can I use fastly prime number calculate method. I remember again. Thank you man. Respect.
Iteration from 2 to n is not a normal method, it's a slow method. Maybe try solving this kata first: https://www.codewars.com/kata/5262119038c0985a5b00029f it focuses on just finding out whether a number is prime, and it requires an algorithm better than linear.
I hate Execution Timed Out (12000 ms). How can I calculate prime number like fastly? I am using normal method. The normal method is count to untill from 2 to n. So I have time problem. Have you any idea?
You meant 13 at the end, not 23, but no, there is no error. That part clearly describes that even if the upper number in the prime pair is outside the range by 1, you should count the pair. It's an exception to a rule. Read the oldest post below. You can agree with it or not, but the instructions are clear about it, so, no error.
What you say confirms the errors, they are the numbers up to 12. The 13 is out of the sequence, the prime numbers up to 12 are only:
2,3,5,7,11
The number 13 is not part of the sequence, for the twin primes UP TO 12 are:
3.5 and 5.7
The 11 does not enter because the 23 is out of sequence.
3-5, 5-7, 11-13
It's been asked and answered before.
In the code test they have erroneous data, for example the number of twin primes up to 12 is 2 and not 3. The error is also repeated in the random test. It is likely that the code that generates the tests has problems because of the module it uses.
test.assert_equals(twin_prime(12), 3)
This comment is hidden because it contains spoiler information about the solution
approved
Ruby Translation
Loading more items...