Retired
Prime numbers are Prime! (retired)
543Tizoy
Loading description...
Fundamentals
Algebra
Mathematics
Algorithms
Logic
Loops
Control Flow
Basic Language Features
Numbers
Data Types
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
passed all test but..show the message " Correct! You may take your time to refactor/comment your solution. Submit when ready."
basically that means you've passed the kata and that message is giving you the option to remove any debugging code like console logs or temp variables or even to reduce the code if possible. but if you have nothing to change just click submit again. If this helps please resolve this issue :)
I can't submit the code, I did the recommendations, but I don't Understand what happen with this.
Some spelling mistakes on the word 'divided' spelt here as 'devided'.
Also, may want to add some tests and explanaition for non-whole numbers. I know most people use 2 as their fail point but if you put 2.1 under your conditions this would be a prime number when it is c;early not.
test output doesn't show values that are tested.
This comment has been hidden.
Added test
Should first of all try easy examples, such as 9, 15, 21 etc. Most of the solutions only check for modulo 2, which only checks for odd/even.
Done.
Some solutions posted but other are incorrect, but they were able to pass the test.
Because of limited tests. I have added some(200) random tests, so cheating would be a bit harder now. Could you resolve the issue as I can't?
Get unresponsive scrpt error multiple times. Have to stop script and reload page.
That's not a kata issue. Most likely a problem with the internet connection, your browser or the codewars server. Could you resolve the issue?
Terrible description. Should rewrite altogether
I'm sure the author would appreciate it more if you suggested a better description rather than just harshly criticising and being very negative about it. It is easy to be critical from your armchair.
Please excuse my initial reaction to reading the problem. You are correct that it is easy to be negative and not easy to provide more constructive feedback.
There are plenty of ways to state the prime number problem. You need to describe the type of input that you will be providing in your test case.
"Write a function that returns a boolean value representing whether or not a given integer is prime. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.
For example:
PrimeTest(1); //false PrimeTest(13); //true PrimeTest(-5); //false "
Stating "given integer" says that the input will be an integer, but nothing further. Also, devided should be divided.
function PrimeTest(a){ return a>0 && a%2 >= 1 ?true:false; }; is the solution for this task. add more test to prevent this.
Added more tests.
1 significant problem, as illustrated by the top solution - your tests only have false cases that are negative or even. You need far more tests to prove a valid function. Consider a random test generator paired with a known-to-be-accurate solution, combined with several non-even false primes.
You have to write more test case with real prime number like 2,3,5,7.
not sure why i'm prompted to refactor my solution. It works...
In the Instructions there is a typo: 'devided' should read 'divided'.
This comment has been hidden.
There is a TYPO ! Its divide not devide.
Duplicate of http://www.codewars.com/kata/is-a-number-prime.
Check for the example cases: -17 is not a prime because is negative, period. And I presume "devided" is mispelled, as only "divided" should be a good form.
More and random test would be highly appreciated.
thanks
My pleasure; I see you changed it to -7, but the test still needs to be fixed; let me know when you have done it and I will eventualy upvote the kata :)
-17 is a prime, so -17 should be evaluated as true.
The description clearly states that a prime has to be greater than 1, so I would say it is definitely false.
Need more test cases. I saw a solution which passed even though it considered 1 to be non-prime. Also, the description needs clarification. You define a prime number as being a natural number (therefore positive), and yet one of the examples states that -17 is non-prime because it is divisible by -1.
There are way more than enough prime number katas already.