5 kyu

Multiples of some primes

22 of 104koba1996
Description
Loading description...
Mathematics
Algorithms
Performance
  • Please sign in or sign up to leave a comment.
  • chapbasil Avatar

    What's mean for Python? Time: 10865ms Passed: 10 Failed: 0 Exit Code: 137 and not about buffer or stderr or etc. But kata is not marked as solved. What should I do?

  • Madjosz Avatar
  • Quark Fox Avatar

    can there be problem after 16th or 17th digits? i dont understand??!! Anyone help?

  • produstoandaluz Avatar

    This is definitely not 5kyu, doesn't matter how I do it, always timeout in th big. Maybe there are some mathematical concepts that need to be taken into consideration? Any clue? :)

  • ANOVA Avatar

    Any performance suggestions? I'm failing on the large test sets.

  • Aceinfurno Avatar

    "I think this task is more about logic than performance, but I still recommend you to optimalize your code"

    my logic is sound and works for the small/medium tests but it times out before it complete the large test. Not sure how to optimize the code to avoid the timeout issue though...

  • EvelDev Avatar

    "I think this task is more about logic than performance, but I still recommend you to optimalize your code", hahahhah funny.

  • EvelDev Avatar

    Its not 5kyu at all, i think its 4 or 3.

  • RealKenshiro Avatar

    This comment has been hidden.

  • Eric96JY Avatar

    timed out ......

  • Madjosz Avatar
  • monadius Avatar

    This comment has been hidden.

  • monadius Avatar

    Random tests:

    1. Arrays of prime numbers can be empty.

    2. The following code

      for (int i = 0; i < 100; i++) {
        String random = new BigInteger(60, new Random()).toString();
        ...
      }
      

      can be changed to

      final Random rnd = new Random();
      for (int i = 0; i < 100; i++) {
        String random = new BigInteger(99, rnd).add(BigInteger.ONE).toString();
        ...
      }
      
    3. Remove System.out.println(numberOfPrimes); from the test code.

  • monadius Avatar

    I suggest to change Integer[] primes to int[] primes everywhere. And don't forget to republish the kata when the issues below are fixed.

  • monadius Avatar

    Random tests are not sufficiently strong:

    1. Random arrays of prime numbers should be tested.
    2. numberLimit should be generated with the existing BigInteger constructor.
  • monadius Avatar

    "a string containing a positive, whole number"

    Random tests may generate negative numbers.

  • Unnamed Avatar

    This comment has been hidden.