Cody

# Problem 659. How long is the longest prime diagonal?

Solution 1029071

Submitted on 24 Oct 2016 by TallBrian
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 = 4; d = 2; %p = isprime(spiral(n));imagesc(p) assert(isequal(prime_spiral(n),d))

hi c = 1 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 2 1 1 0 0 0 1 0 3 1 1 0 0 0 1 0 2 1 1 0 0 0 1 0 2 0 0 0 0 0 0 0 1 c = 0 0 0 1 0 0 0 0 0 1 0 0 1 1 0 1 0 1 1 2 0 1 0 1 1 2 0 1 0 1 1 2 0 1 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 hi c = 1 0 0 0 0 0 0 1 1 1 0 0 1 0 2 1 1 0 0 1 0 2 1 1 0 0 1 0 2 0 0 0 0 0 0 1 c = 0 0 1 0 0 0 0 1 0 0 1 1 1 0 1 1 2 0 0 1 1 2 0 1 1 0 1 0 1 0 0 0 0 1 0 0 hi c = 1 0 0 0 0 0 1 1 1 0 1 0 1 1 1 0 1 0 2 0 0 0 0 0 1

2   Pass
n = 7; d = 4; assert(isequal(prime_spiral(n),d))

hi c = 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 2 0 1 0 1 0 0 0 0 0 0 0 2 0 2 1 2 0 1 0 0 0 0 0 0 0 3 0 3 1 3 0 1 0 0 0 0 0 1 0 3 0 4 1 3 0 1 0 0 0 1 0 1 0 3 0 5 1 3 0 1 0 0 0 1 0 1 0 3 0 4 1 3 0 0 0 0 0 1 0 1 0 3 0 4 1 2 0 0 0 0 0 1 0 1 0 2 0 3 1 2 0 0 0 0 0 1 0 1 0 1 0 3 0 1 0 0 0 0 0 1 0 1 0 0 0 2 0 0 0 0 0 0 0 1 0 0 0 0 0 1 c = 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 2 0 0 0 0 0 0 0 1 0 1 0 3 0 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