Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    You need to swap assert's arguments actual and expected results in java test cases. Currently, it's showing the actual result as expected and vice versa.

  • Custom User Avatar

    Golang Translation with Improved Testing

    There are a few differences that I want to highlight:

    • Test case added for minimum n (n = 1)
    • Test case added for maximum n (n = 10000)
    • Test cases added for randomly generated n (1 ≤ n ≤ 10000)
    • Solution changed to be capable of solving high n (n ≈ 10000)

    The previous solution couldn't handle n = 10,000. It would panic with a runtime error: index out of range. The reason for the panic is that the sieve was of size 70,000 which isn't enough natural numbers to find 10,000 ludic numbers. If you attempt to increase the size of the sieve, then the process will timeout. My solution can handle n ≈ 25000 before timeout occurs.

    The modifications to the test cases are to increase test coverage to include the minimum and maximum n

  • Custom User Avatar

    You should fix the sample test with Java, it's actually broken and it doesn't compile at all.

  • Custom User Avatar

    I'm getting False should equal True on the last test Up to one million, when I add the check on divisibility on primes from 2 to 199.

    Does it mean, that reference solution fails to recognize, that number is not prime?

  • Custom User Avatar

    Needs random tests.

  • Custom User Avatar

    Add some more info about the testing: the number of tests.

    Also, add some meaningful error message when people fail, instead of just break; e.g.

    Test.assert_equals(tb, cb, "Failed prime check for %s" % n)
    
  • Custom User Avatar

    There are already loads of prime related katas; although this one really goes for performance, which is good. But it's too tight: the 1.7 million(!) tests are so heavy that the same code that passes in Python 2, fails in Python 3, which is bad.

    So even though I'm happy to see a performance prime testing kata (please add as a tag), I suggest to

    • reduce the number of the large random tests from 700k to 3-500k
    • test only odd numbers in the "up to 1M" tests