7 kyu
Check for prime numbers
3,880 of 5,620cmgerber
Loading description...
Algorithms
Mathematics
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.
https://www.codewars.com/kata/5262119038c0985a5b00029f/python
Duplicate Kata
Thank you , I've been able to change the code. @chrono79
I need help, my code does exactly what it's supposed to . But its not passing me I don't understand
A problem with your code is not a kata issue, please read this: https://docs.codewars.com/training/troubleshooting
Your code is wrong btw.
python fork with new test framework
Approved
This one a bit tricky.
This comment has been hidden.
Your code is wrong, 8177 is not a prime number. It's divisible by 13. Not a kata issue. Read this please: https://docs.codewars.com/training/troubleshooting/
Thanks for your explanation
Java Translation kumited :) Please check and approve ~~
Python reference solution is flawed; even numbers are not prime.
fixed :) and i PM u asking about something, do go and check
ruby translation kumited :) Please check and approve ~~
Please see issue above for Python. (the translation can't be approved yet)
no random tests in python
added
javascript translation Kumited! Please Accept :D
Approved fork
Duplicate of http://www.codewars.com/kata/is-a-number-prime.
Please add a power of two to the test cases. That would invalidate incorrect solutions like this, which don't check for divisibility by two.
For n = 12, my solution fails and I get this
Expected: true, instead got: false Isn't this wrong ? Similar is the case with n = 25
Another bugged test case: None should equal False
If '0' or 'None' is passed the function returns False. However, it errors out on submit.
Don't see what's the problem.
Maybe put a really large prime in there so doing an odd range of 3 to n would be extremely slow.
To make this kata more difficult, you could put a computational time limit on it and test some very large primes. This would make testing n / every odd number from 3 -> sqrt(n) infeasable.
This comment has been hidden.
Thanks, I just added it.
What about input restrictions? Solutions for small integers would be completely different from big ones.
The description should include that only non-negative values are tested. I'd add tags 'Numbers' and 'Mathematics'.
Thanks, updated.