Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I was wondering why I couldn't get an arrow function to work with implicit return...thanks!
Out of specs, so no. Don't arbitrarily introduce feature creep (especially if it's pointless).
Also have you realized that everyone except you are clinging onto that definition? Maybe you haven't considered that fact that it's you who was wrong all along?
Yeah I get the Idea that You should do as the Kata asks. And no the definition states that ±1 is not prime. I am just want to point that this Kata is using a wrong defintion of Prime numbers.
After 26,569 completions nobody is going to change the kata to do something else, the description is clear and states what you should consider a prime number and what not. Having another definition that applies to another set of numbers (integers vs natural) is pointless. Also, by your definition is p=±1 prime?
I looked that up on my books and here is the definition:
An integer p is said to be prime if p≠0,±1 and the only divisors of p are ±1 and ±p.
Which means
p is prime if and only if −p is prime.
I think the kata should include negative numbers too.
mmm I need to check my maths too, apparently... x)
I don't even know why we are discussing this when in the description it says:
Works fine now.
That's wrong though, because by that you can also argue that
5
is divisible by-5
, and hence not a prime number ;-)The point is, when we do math related to prime numbers we only consider natural numbers, where negative numbers simply doesn't exist. It's excluded by definition.
you need to check your maths.
Definition of a prime: "number that is only divisible by 1 and itself."
-5
is divisible by5
=> not a prime.I made a typo, I wanted to say that this Kata is assuming that prime numbers cannot be negative. Well, mathematically speaking, That's wrong. -5 for example is a prime number. which is not the case in this Kata.
It seems you didn't read the kata description:
Err, no, it's not. Try returning
num > 0
and check if there is any tests that's not passing with a negative number.Have you read the prime number definition in the kata's description? No ambiguities there. The number passed to your function can be negative, but it won't be a prime number by definition.
Your solution is assuming that prime numbers can't be negative. But that's not your fault since the author is having the same problem.
This Kata is assuming that prime numbers are negative. How can I contribute and fix it? Can someone please tell me !
Loading more items...