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.
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.
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.
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.
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 !
forEach: This iterates over a list and applies some operation with side effects to each list member (example: saving every list item to the database)
map: This iterates over a list, transforms each member of that list, and returns another list of the same size with the transformed members (example: transforming list of strings to uppercase)
ref: https://stackoverflow.com/questions/34426458/javascript-difference-between-foreach-and-map