7 kyu

Array of all primes up to number N

351 of 494otamm
Description
Loading description...
Mathematics
Algorithms
  • Please sign in or sign up to leave a comment.
  • farhanaditya Avatar

    Initial Solution Setup:

    var primeArray = function(n) {
      var primeArray = [];
      // fill it with primes up to 'n'
      return primeArray;
    }
    

    I don't think overwriting its own function is a good practice.

  • ejini战神 Avatar
    • Ruby 3.0 should be enabled (Refer this & this for more detail)
  • cliffstamp Avatar

    This comment has been hidden.

    • akar-0 Avatar

      It often happens kata difficulties are very different from one language to another.That may be because of different builtin functions, sometimes because tests are not equitable... If we follow this, many katas should be restricted to a few languages, or exclude some others... For example a language like C has very few builtin functions in comparison with others... so what should we do? Restrict translations of original C katas and Restrict translations of other languages to C? Moreover when languages are updated they may have new builtin functionalities. This is not actually manageable, this is a very general issue on CW, it's part of it, we have to do with it.

      Issue marked resolved by akar-0 4 years ago
    • farhanaditya Avatar

      @akar-0 it's the translator's responsibility to ensure the difficulty stays the same.

  • bestwebua Avatar

    Thanks for the nice kata!

  • matt c Avatar

    needs random test cases :(

    • otamm Avatar

      Random test cases now available for both Ruby and Javascript versions.

      Issue marked resolved by otamm 9 years ago
  • smile67 Avatar

    It a duplicate: http://www.codewars.com/kata/array-of-primes And error in testcase... ([]!=[]? a.s.o)

    • otamm Avatar

      Not exactly a duplicate; this kata asks for primes in a range, mine asks for all primes up to a number. Similar logic, yes, but not "duplicate". Also, is this error in the Ruby or Javascript version?

    • smile67 Avatar

      Yes i saw, copied my old solution and set s=1 for start at 1 - that's all... Error was in JS - same as my solution...

    • otamm Avatar

      Cool, I've catched the error and it's been corrected.

      Issue marked resolved by otamm 9 years ago