Ad
  • Custom User Avatar

    Java && Python && Ruby:

    Missing following fixed tests, causing Incorrect Java solution && incorrect Python solution && incorreect Ruby solution to bypass

    x^-1

    -x^-1

  • Custom User Avatar

    Acually it does "Your task is to create a function that..." implies to calculate the solution no "find" a trick to pass the tests (Even sample tests suggests I have to perform calculations). And I get it, I'm new here and assumed ever challenge requires you to write a code, not return one word/number because there is a trick to the challenge. I guess I learned that if challenge is too hard for its rank there may be a trick to it. ( But still author should not be lazy and write a real solution for 536! so I can learn something ;P ) Cheers

  • Custom User Avatar

    No, the challenge does not ask you to do any of this. The method you use to solve is irrelevant (as long as it's not cheating). If you want to solve it by calculating 536! then go ahead, but this challenge can be solved without calculating 536!, in a way which can be deemed 8 kyu.

  • Custom User Avatar

    So this challenge asks you to understand Wilson prime, write Factorial function because your language doesn't have it (D lang) and optimase the function to handle numbers like 536! and it's 8kyu? My last 8kyu asked me to convert int to string.

  • Custom User Avatar

    The main issue of this task is number overflow.

    I would counter this with "the main issue of this task is users going the hard way and jumping right into coding instead of doing 5 minutes worth of research" :)

  • Custom User Avatar

    The main issue of this task is number overflow. Factorial of given n would easily overflow that variable type can hold. The trick I used is limiting any calculated results within variable range: input type (RUST) is u32 and we have to do n^2, so we need to make sure any temp results within u64 (Whatever type we chose, factorial will exceed). Here is exact reason why modulo was introduced. When a temp number is about to overflow, MOD(n^2).

    This is definitely not an 8 kyu, I got frustrated with endless overflow errors when I tried, and lol when I see "known Wilson Primes" way.

  • Custom User Avatar

    Man I'm always up for googling that's most of what we do but this is not an 8 kyu.

  • Custom User Avatar

    need a better explanation or higher level(in c++ 563 is gives a buffer overflow)

  • Custom User Avatar

    1 is not a prime number Edit: sorry, new to Codewars and haven't seen the 'Expand replies' feature

  • Custom User Avatar

    Fixed.

  • Custom User Avatar

    The wiki actualy says 1 is a wilson prime though its not

  • Custom User Avatar
  • Custom User Avatar

    I think that it is not possible to change the level.

  • Custom User Avatar

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

  • Custom User Avatar

    please consider adding a bit help to your description here:

    Your task is to create a function that returns true if the given number is a "known Wilson prime" and false otherwise.

  • Loading more items...