Ad
  • Custom User Avatar

    I was trying to figure out why my solution was timing out in R, and out of curiosity I had the function immediately return a list of FALSE and the input hand (code below). I was surprised to see that the server regularly took about 8500ms to process and return the test results. Is anyone else able to duplicate this? If the code that evaluates this kata is really that inefficient then I don't see how someone could complete it.

    play_if_enough <- function(a, b) list(FALSE, a)

  • Custom User Avatar

    They are basically the same. As per the documentation:

    paste0(..., collapse) is equivalent to paste(..., sep = "", collapse), slightly more efficiently.

  • Custom User Avatar

    Was the timeout limit set at 12 seconds when you wrote this? I feel like I have a decent Sieve algorithm, but it only makes it through one of your five large tests before timing out.

  • Custom User Avatar

    Hello, I am seeing an unexpected result when attempting this kata. One example is the input a = 260 and b = 260001. In my opinion the prime factors of 260001 are: 3, 3, 7, and 4127. Since 260 is not evenly divisble by all of these numbers (in fact it is not divisible by any of them), I believe the correct result should be FALSE. My code returns FALSE, but it then fails the test for this input. If the correct answer for this input pair is actually TRUE could someone please explain why; I may be misunderstanding the kata or have the wrong prime factors. If the correct answer is FALSE, can you confirm if the reference solution is actually returning this result in R? I will also mention that my code passes ~95% of the test cases, but it fails with input shown below, which appears to follow a pattern:

    • a = 360; b = 360001
    • a = 580; b = 5800001
    • a = 980; b = 980001
    • a = 570; b = 57001
    • a = 110; b = 1100001
    • a = 30; b = 300001
  • Custom User Avatar

    Thank you for this, much needed!