Cody

Problem 46047. Identify Wagstaff primes

Solution 2751490

Submitted on 28 Jul 2020 by Asif Newaz
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   Pass
n = 3; assert(isWagstaff(n))

tf = logical 1

2   Pass
n = 11; assert(isWagstaff(n))

tf = logical 1

3   Pass
n = 43; assert(isWagstaff(n))

tf = logical 1

4   Pass
n = 10923; assert(~isWagstaff(n))

tf = logical 0

5   Pass
n = 178956971; assert(~isWagstaff(n))

tf = logical 0

6   Pass
n = 2932031007403; assert(isWagstaff(n))

tf = logical 1

7   Pass
q = primes(40); n = (2.^q+1)/3; assert(isequal(isWagstaff(n),[0 1 1 1 1 1 1 1 1 0 1 0])),

tf = 1×12 logical array 0 1 1 1 1 1 1 1 1 0 1 0

Suggested Problems

More from this Author50

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!