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.
fair
but semicolons and newlines aren't allowed (i forgot to add that test)
I agree, just call it "Code Golf: ..." instead. This is consistent with other code golf kata's.
retired
@lechevalier and I came up with a pure Python solution that passes the full tests. No NumPy, no gmpy2. Just over twenty lines, quite readable, nothing fancy. Finding the most efficient data types and iterators for the task took a bit of trial and error, but it's definitely possible.
I don't think that
gmpy2.next_prime
is a fast function. It returns probable prime numbers for sufficiently large inputs. By the same logic,BigInteger.nextProbablePrime
should work in Java. Nevertheless, I agree that Python is not a good language for this kata. (Currently, the best available language is Rust.)There's a gmpy2-based solution.
gmpy
is too slow to pass the python translation btwThe literal only way you're passing it is ahead-of-time sieving with numpy
Yushi is right, Python is not the language for this and ideally the translation would have been rejected, but now that it isn't we need to fix it. Fixing it means we're gonna need to throw the module blocker at it.
I added a Python description, and I'll add more random tests. I'll close this issue, since there already is an issue about the general lack of random tests.
I think Python is fine for this task. If you want to do number crunching in Python, you need numpy, gmpy2, or something like that. That's what you'll need for this kata. Perfectly normal and appropriate. :-)
A C translation would be great! I just approved a C translation of Prime Streaming (PG-13). I guess we could use the same stream API here. Of course, the solution will have to be much faster, and the tests much tougher.
@QKiryu: These tests would burn about as much CPU time as the solution, which means there's about half as much time left for the solution. That's no good. Sorry! I rejected your translation.
https://www.codewars.com/kata/59122604e5bc240817000016 a minor fork to attempt to deal with this
yeah I totally agree
This comment is hidden because it contains spoiler information about the solution
Did not know toddlers could do division.
Thank you for this, didn't understand the requirement until I read this!
Loading more items...