Problem 981. Find nearest prime number less than input number
Solution Stats
Problem Comments
-
6 Comments
1 isn't a prime number
agree @bmtran...
You should correct the test suite. 1 isn't a prime number.
Correct the test suite 1 is not prime number.
1 is not a prime number, in order to fulfill with the fundamental theorem of arithmetic:
https://en.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic
https://en.wikipedia.org/wiki/Prime_number#Primality_of_one
I removed the test case where n==2, since 1 is indeed not a prime number. I also added a random test case, so the problem is not so easily cooked by knowing all the test cases.
Solution Comments
-
1 Comment
Well I think number 1 is not a prime number, but I need to pass the test. So I wander all the right answer may be possibly wrong since you have 1.
-
1 Comment
IMHO 1 is not a prime, so that on input n=2 the correct answer should be [] and not 1.
-
1 Comment
これで正しいだろ。
-
2 Comments
you still not change the wrong test suite:4.1 is not a prime.
agree with bainhome
Problem Recent Solvers458
Suggested Problems
-
1905 Solvers
-
Determine if a Given Number is a Triangle Number
352 Solvers
-
438 Solvers
-
330 Solvers
-
Mersenne Primes vs. All Primes
357 Solvers
More from this Author11
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!