6 kyu

Special Multiples

413 of 1,329raulbc777
Description
Loading description...
Mathematics
Algorithms
Fundamentals
  • Please sign in or sign up to leave a comment.
  • danielgomesdev Avatar

    How can I fix this? Passed tests, but can't submit...

    FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

  • rjiuha Avatar

    Can't finish task. Please help. Language: Go

    Test Passed Completed in 0.1059ms Attempt error: STDERR Execution Timed Out (12000 ms)

  • saudiGuy Avatar

    This comment has been hidden.

  • Msous001 Avatar

    time expire is not correct

  • zags97 Avatar

    FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

    all test passed but i cannot submit

    Time: 3892ms Passed: 17Failed: 0Exit Code: 139

  • 66  Avatar

    Please review: C++ Translation

  • LS2008 Avatar

    heh, love this kata... is it possible just to cover some edge cases?

  • adbiLenLa Avatar

    a very nice kata indeed

    #11b39/3qf:0z:vV

  • ejini战神 Avatar

    Description should be language-agnostic -> refering to count_specMult(3, 200)

  • akar-0 Avatar

    This comment has been hidden.

  • ejini战神 Avatar

    Description should be language-agnostic

  • ejini战神 Avatar
    • Ruby 3.0 should be enabled

    • Also, function and parameter name should be snake_case

  • ejini战神 Avatar

    Python new test framework should be used

  • ejini战神 Avatar

    JS NOde 14. should be enabled

  • B1ts Avatar

    Input constraints should be mentioned. How high does n go? (1e9) How many consecutive primes can we expect? (up to 10, looking at JS version)

    These are important pieces of information to tailor your algorithm to.

  • akar-0 Avatar
  • Shahraiz19 Avatar

    This comment has been hidden.

  • RealKenshiro Avatar

    Interesting but the example is a little bit misleading : I thought I have to find numbers whose prime factors are ALL in the set of the first N primes...

    For example :

    count_specMult(3, 210) = 7 as 210 = 2 * 3 * 5 * 7 but 7 is not in the first 3 primes.

    The real problem is much simpler than I thought.

  • FArekkusu Avatar

    The function name should be in snake_case in Python.

  • anter69 Avatar
    • no edge cases to enforce a proper solution (at leas python, ruby); the description says:

      finds the amount of numbers [...] below a given value, maxVal

      thus, add the following to all languages: count_specMult(2, 12) == 1

    • solver fails for the above edge case (at least python, maybe others)

    • no random tests (python)

  • Gorgoroth Avatar

    Performance KATA of the same as a suggestion.. thanks for the KATA BTW!

  • user5036852 Avatar

    Very nice Kata! Interesting how smart and short the best solution is!

  • St3f4n Avatar

    I'm having the same problem with execution time(Process was terminated. It took longer than 6000ms to complete), althought I have 18 Passed 0 Failed 0 Errors and when simply running tests(not submiting) process takes about 50ms?!

  • pranita Avatar

    i'm getting this error...

    Random Tests******* countSpecMult Tests n: 11 max: 125389642886 Expected: 0 Process was terminated. It took longer than 6000ms to complete 0 Passed 0 Failed 0 Errors

  • pranita Avatar

    HI, EVEN I'M GETTING PROBLEM AS THIS CODE STOP EXECUTING AS EXECUTION TIME IS >6S.WHAT CAN BE SOLUTION FOR THIS? ALSO FOR GIVEN TEST CASE IT'S RUNNING ABSOLUTELY FINE.PLEASE TELL ME HOW TO OVER COME THIS? IT'S GIVING ERROR ON RANDOM TESTING WHEN N= 8 AND MAXVAL = 11728597661

  • tobywilkins Avatar

    This comment has been hidden.

  • lucasbraganca Avatar

    My code seems to be running alright and I'm using memoization in order to speed it up. Nonetheless, I'm still not able to submit my solution under 6s seconds ("Run Test" goes pretty quickly though). What other ways should I go through?

  • user6361752 Avatar

    Pretty sure it must be mentioned that divisers are not only prime numbers but INCLUDE prime numbers - in that case solution is very simple.

  • RobinKnipe Avatar

    This comment has been hidden.

  • acraileanu Avatar

    Looking at the hard coded values for primes, which doesn't seem very programming-style to me, perhaps tests should be added for larger numbers as well.

  • acraileanu Avatar

    C# version seems to have some issues (apart from no input test cases):

    • Error: Command failed: /tmp/csharp116328-19-11naej9/fixture.cs(16,36): error CS1502: The best overloaded method match for `CountMultiples.CountSpecMult(int, long)' has some invalid arguments
  • geresdi Avatar

    Maybe it is only me, but from the description it looks like you are looking for numbers that only contain the first n primes as factors. Unfortunately, the provided example also points in this direction (since the first counterexample would be 2x3x5x7=210>200). Granted, the second test case gives it away, but a more clear description could have saved me a lot of headache :)

  • veddster Avatar

    Typo

    Below is spelled "bellow" in the description.

  • andraz.frelih Avatar

    Try to keep it simple. I tried with a neat object based solution at first, but time got me there. After thinking about primesmore it finnaly dawned on me:)

  • mudrenok Avatar

    Sup, I think you should mention maximum count of primes in your tests. You can use memoization and sieve of eratosthenes for this type of tasks, but when you have only first 10 primes it's redundant.

  • g964 Avatar

    Good one, upvoted!

  • CIS 122 Avatar

    This comment has been hidden.

  • CIS 122 Avatar

    I massively overthought this one and spent hours trying to get my solution fast enough. Then I had an epiphany, and it turned out to be ridiculously easy :)

  • NaMe613 Avatar

    Ruby translation kumited.

  • raulbc777 Avatar

    Thanks a lot for your vigilance and message. It's solved. Your suggestions are wellcome.

  • NaMe613 Avatar

    The function name is not the same for the example tests as for the actual tests.