Problem 44385. Extra safe primes
Solution Stats
Problem Comments
-
4 Comments
15 = 2*7+1 and 7 = 2*3+1 so 15 should be a safe prime. Am I missing something?
An (extra) safe prime number itself must be a prime number. Here, 15 is not a prime, so it is not (extra) safe prime
For case 8, x = 719;
which will lead to 44, not prime, the result should be false, but it's true now.
Am I right?
danteliujie, x = 719 does not lead to 44.
Solution Comments
-
1 Comment
Why can't 71 be true?
-
1 Comment
Ups, 'maybe' 15 is not prime at all...
-
1 Comment
Oh sorry. I mean for Test #7
-
2 Comments
Test #5 x = 15;
15 = 2*7 + 1
7 = 2*3 + 1
3 is a prime number. therefore 7 is a safe prime. AND 15 is an extra safe prime. Or is there anything wrong with the equations above?
Lol. Forgot that 15 is not even a prime number.
-
1 Comment
isprime already exists!
-
1 Comment
This code would incorrectly identify x = 59 as an extra-safe prime (which it's not).
-
2 Comments
When x = 5 and x = 7, return false, is it right?
Yes, x = 5 and x = 7 are safe primes, but not "extra" safe primes because their corresponding values for p (2 and 3, respectively) are not safe primes.
-
2 Comments
This solution would incorrectly identify x = 71 as an extra-safe prime (which it's not).
Good catch, yurenchu. I'm adding 71 to the test suite.
Problem Recent Solvers708
Suggested Problems
-
1772 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
8171 Solvers
-
659 Solvers
-
3588 Solvers
-
261 Solvers
More from this Author44
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!