Cody

# Problem 44385. Extra safe primes

Solution 1461290

Submitted on 12 Mar 2018
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
x = 0; assert(isequal(isextrasafe(x),false))

----------------------------------------------------------------------------------------------------- MATLAB Version: 9.3.0.768594 (R2017b) Update 3 MATLAB License Number: Operating System: Linux 4.14.15-041415-generic #201801231530 SMP Tue Jan 23 20:33:21 UTC 2018 x86_64 Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.3 (R2017b)

Error using isprime (line 19) All entries of X must be nonnegative integers. Error in isextrasafe (line 4) isprime([ans (ans-1)/2]); Error in Test1 (line 2) assert(isequal(isextrasafe(x),false))

2   Fail
x = 5; assert(isequal(isextrasafe(x),false))

----------------------------------------------------------------------------------------------------- MATLAB Version: 9.3.0.768594 (R2017b) Update 3 MATLAB License Number: Operating System: Linux 4.14.15-041415-generic #201801231530 SMP Tue Jan 23 20:33:21 UTC 2018 x86_64 Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.3 (R2017b)

Error using isprime (line 19) All entries of X must be nonnegative integers. Error in isextrasafe (line 4) isprime([ans (ans-1)/2]); Error in Test2 (line 2) assert(isequal(isextrasafe(x),false))

3   Fail
x = 7; assert(isequal(isextrasafe(x),false))

----------------------------------------------------------------------------------------------------- MATLAB Version: 9.3.0.768594 (R2017b) Update 3 MATLAB License Number: Operating System: Linux 4.14.15-041415-generic #201801231530 SMP Tue Jan 23 20:33:21 UTC 2018 x86_64 Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.3 (R2017b)

Assertion failed.

4   Fail
x = 11; assert(isequal(isextrasafe(x),true))

----------------------------------------------------------------------------------------------------- MATLAB Version: 9.3.0.768594 (R2017b) Update 3 MATLAB License Number: Operating System: Linux 4.14.15-041415-generic #201801231530 SMP Tue Jan 23 20:33:21 UTC 2018 x86_64 Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.3 (R2017b)

Assertion failed.

5   Fail
x = 15; assert(isequal(isextrasafe(x),false))

----------------------------------------------------------------------------------------------------- MATLAB Version: 9.3.0.768594 (R2017b) Update 3 MATLAB License Number: Operating System: Linux 4.14.15-041415-generic #201801231530 SMP Tue Jan 23 20:33:21 UTC 2018 x86_64 Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.3 (R2017b)

Assertion failed.

6   Fail
x = 23; assert(isequal(isextrasafe(x),true))

----------------------------------------------------------------------------------------------------- MATLAB Version: 9.3.0.768594 (R2017b) Update 3 MATLAB License Number: Operating System: Linux 4.14.15-041415-generic #201801231530 SMP Tue Jan 23 20:33:21 UTC 2018 x86_64 Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.3 (R2017b)

Assertion failed.

7   Fail
x = 71; assert(isequal(isextrasafe(x),false))

----------------------------------------------------------------------------------------------------- MATLAB Version: 9.3.0.768594 (R2017b) Update 3 MATLAB License Number: Operating System: Linux 4.14.15-041415-generic #201801231530 SMP Tue Jan 23 20:33:21 UTC 2018 x86_64 Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.3 (R2017b)

Assertion failed.

8   Fail
x = 719; assert(isequal(isextrasafe(x),true))

----------------------------------------------------------------------------------------------------- MATLAB Version: 9.3.0.768594 (R2017b) Update 3 MATLAB License Number: Operating System: Linux 4.14.15-041415-generic #201801231530 SMP Tue Jan 23 20:33:21 UTC 2018 x86_64 Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.3 (R2017b)

Assertion failed.

9   Fail
x = 2039; assert(isequal(isextrasafe(x),true))

----------------------------------------------------------------------------------------------------- MATLAB Version: 9.3.0.768594 (R2017b) Update 3 MATLAB License Number: Operating System: Linux 4.14.15-041415-generic #201801231530 SMP Tue Jan 23 20:33:21 UTC 2018 x86_64 Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.3 (R2017b)

Assertion failed.

10   Fail
x = 2040; assert(isequal(isextrasafe(x),false))

----------------------------------------------------------------------------------------------------- MATLAB Version: 9.3.0.768594 (R2017b) Update 3 MATLAB License Number: Operating System: Linux 4.14.15-041415-generic #201801231530 SMP Tue Jan 23 20:33:21 UTC 2018 x86_64 Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.3 (R2017b)

Error using isprime (line 19) All entries of X must be nonnegative integers. Error in isextrasafe (line 4) isprime([ans (ans-1)/2]); Error in Test10 (line 2) assert(isequal(isextrasafe(x),false))

11   Fail
x = 5807; assert(isequal(isextrasafe(x),true))

----------------------------------------------------------------------------------------------------- MATLAB Version: 9.3.0.768594 (R2017b) Update 3 MATLAB License Number: Operating System: Linux 4.14.15-041415-generic #201801231530 SMP Tue Jan 23 20:33:21 UTC 2018 x86_64 Java Version: Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.3 (R2017b)

Assertion failed.