Cody

Problem 659. How long is the longest prime diagonal?

Solution 669859

Submitted on 13 May 2015 by Jonathan Campelli
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))

lgt = Empty matrix: 1-by-0 lgt = 1 maximum = 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 2 maximum = 0 1 0 2 lgt = 1 1 maximum = 0 1 0 2 1 lgt = 1 maximum = 0 1 0 2 1 1 lgt = 2 maximum = 0 1 0 2 1 1 2 lgt = 1 maximum = 0 1 0 2 1 1 2 1 lgt = 1 maximum = 0 1 0 2 1 1 2 1 1 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = 0 1 0 2 1 1 2 1 1 0 1 solution = 2

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

lgt = 1 maximum = 1 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = 1 0 1 lgt = Empty matrix: 1-by-0 lgt = 3 maximum = 1 0 1 0 3 lgt = Empty matrix: 1-by-0 lgt = 1 1 3 maximum = 1 0 1 0 3 0 3 lgt = 1 1 maximum = 1 0 1 0 3 0 3 1 lgt = 1 2 maximum = 1 0 1 0 3 0 3 1 2 lgt = 2 maximum = 1 0 1 0 3 0 3 1 2 2 lgt = 1 maximum = 1 0 1 0 3 0 3 1 2 2 1 lgt = 2 maximum = 1 0 1 0 3 0 3 1 2 2 1 2 lgt = 1 maximum = 1 0 1 0 3 0 3 1 2 2 1 2 1 lgt = 3 maximum = 1 0 1 0 3 0 3 1 2 2 1 2 1 3 lgt = Empty matrix: 1-by-0 lgt = 4 maximum = 1 0 1 0 3 0 3 1 2 2 1 2 1 3 0 4 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = Columns 1 through 16 1 0 1 0 3 0 3 1 2 2 1 2 1 3 0 4 Columns 17 through 18 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = Columns 1 through 16 1 0 1 0 3 0 3 1 2 2 1 2 1 3 0 4 Columns 17 through 20 0 1 0 1 solution = 4

3   Pass
%% n = 13; d = 5; assert(isequal(prime_spiral(n),d))

lgt = Empty matrix: 1-by-0 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = 0 0 1 lgt = Empty matrix: 1-by-0 lgt = 2 maximum = 0 0 1 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 2 2 maximum = 0 0 1 0 2 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 maximum = 0 0 1 0 2 0 2 0 1 lgt = Empty matrix: 1-by-0 lgt = 5 1 maximum = 0 0 1 0 2 0 2 0 1 0 5 lgt = Empty matrix: 1-by-0 lgt = 1 2 1 3 maximum = 0 0 1 0 2 0 2 0 1 0 5 0 3 lgt = 1 maximum = 0 0 1 0 2 0 2 0 1 0 5 0 3 1 lgt = 1 1 2 2 maximum = 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 lgt = 1 maximum = 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 lgt = 1 1 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Column 17 1 lgt = 1 1 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 18 1 1 lgt = 1 1 1 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 19 1 1 1 lgt = 1 2 1 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 20 1 1 1 2 lgt = 1 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 21 1 1 1 2 1 lgt = 3 2 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 22 1 1 1 2 1 3 lgt = 1 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 23 1 1 1 2 1 3 1 lgt = 1 2 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 24 1 1 1 2 1 3 1 2 lgt = 1 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 25 1 1 1 2 1 3 1 2 1 lgt = 3 1 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 26 1 1 1 2 1 3 1 2 1 3 lgt = Empty matrix: 1-by-0 lgt = 1 5 2 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 28 1 1 1 2 1 3 1 2 1 3 0 5 lgt = Empty matrix: 1-by-0 lgt = 1 1 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 30 1 1 1 2 1 3 1 2 1 3 0 5 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 4 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 32 1 1 1 2 1 3 1 2 1 3 0 5 0 1 0 4 lgt = Empty matrix: 1-by-0 lgt = 3 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 32 1 1 1 2 1 3 1 2 1 3 0 5 0 1 0 4 Columns 33 through 34 0 3 lgt = Empty matrix: 1-by-0 lgt = Empty matrix: 1-by-0 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = Columns 1 through 16 0 0 1 0 2 0 2 0 1 0 5 0 3 1 2 1 Columns 17 through 32 1 1 1 2 1 3 1 2 1 3 0 5 0 1 0 4 Columns 33 through 38 0 3 0 0 0 1 solution = 5

4   Pass
%% n = 52; d = 6; assert(isequal(prime_spiral(n),d))

lgt = Empty matrix: 1-by-0 lgt = Empty matrix: 1-by-0 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = 0 0 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = 0 0 0 1 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = 0 0 0 1 0 1 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 1 maximum = 0 0 0 1 0 1 0 1 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 3 1 maximum = 0 0 0 1 0 1 0 1 0 1 0 3 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = 0 0 0 1 0 1 0 1 0 1 0 3 0 1 lgt = Empty matrix: 1-by-0 lgt = 2 2 1 1 maximum = 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 18 0 1 lgt = Empty matrix: 1-by-0 lgt = 2 3 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 20 0 1 0 3 lgt = Empty matrix: 1-by-0 lgt = 1 2 2 2 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 22 0 1 0 3 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 3 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 24 0 1 0 3 0 2 0 3 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 2 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 26 0 1 0 3 0 2 0 3 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 2 1 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 28 0 1 0 3 0 2 0 3 0 2 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 3 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 30 0 1 0 3 0 2 0 3 0 2 0 2 0 3 lgt = Empty matrix: 1-by-0 lgt = 3 2 1 1 1 2 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 2 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 34 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 3 3 2 3 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 36 0 2 0 3 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 38 0 2 0 3 0 1 lgt = Empty matrix: 1-by-0 lgt = 2 2 1 1 2 1 2 2 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 40 0 2 0 3 0 1 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 3 2 1 2 2 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 42 0 2 0 3 0 1 0 2 0 3 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 2 2 1 1 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 44 0 2 0 3 0 1 0 2 0 3 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 1 1 2 2 1 1 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 46 0 2 0 3 0 1 0 2 0 3 0 2 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 1 1 1 1 1 1 2 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 48 0 2 0 3 0 1 0 2 0 3 0 2 0 2 0 2 lgt = Empty matrix: 1-by-0 lgt = 4 1 4 1 1 5 1 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 48 0 2 0 3 0 1 0 2 0 3 0 2 0 2 0 2 Columns 49 through 50 0 5 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 2 2 1 3 2 1 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 48 0 2 0 3 0 1 0 2 0 3 0 2 0 2 0 2 Columns 49 through 52 0 5 0 3 lgt = 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 48 0 2 0 3 0 1 0 2 0 3 0 2 0 2 0 2 Columns 49 through 53 0 5 0 3 1 lgt = 1 1 1 1 2 4 2 1 1 2 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 48 0 2 0 3 0 1 0 2 0 3 0 2 0 2 0 2 Columns 49 through 54 0 5 0 3 1 4 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 2 1 1 1 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 48 0 2 0 3 0 1 0 2 0 3 0 2 0 2 0 2 Columns 49 through 56 0 5 0 3 1 4 0 2 lgt = 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 48 0 2 0 3 0 1 0 2 0 3 0 2 0 2 0 2 Columns 49 through 57 0 5 0 3 1 4 0 2 1 lgt = 1 1 1 2 2 1 1 1 1 2 1 1 1 1 maximum = Columns 1 through 16 0 0 0 1 0 1 0 1 0 1 0 3 0 1 0 2 Columns 17 through 32 0 1 0 3 0 2 0 3 0 2 0 2 0 3 0 3 Columns 33 through 48 0 2 0 3 0 1 0 2 0 3 0 2 0 2 0 2 Columns 49 throu...

5   Pass
%% n = 81; d = 9; assert(isequal(prime_spiral(n),d))

lgt = Empty matrix: 1-by-0 lgt = Empty matrix: 1-by-0 lgt = Empty matrix: 1-by-0 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = 0 0 0 0 1 lgt = Empty matrix: 1-by-0 lgt = 3 maximum = 0 0 0 0 1 0 3 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 maximum = 0 0 0 0 1 0 3 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = 0 0 0 0 1 0 3 0 1 0 1 lgt = Empty matrix: 1-by-0 lgt = 3 1 1 maximum = 0 0 0 0 1 0 3 0 1 0 1 0 3 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 maximum = 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Column 17 1 lgt = Empty matrix: 1-by-0 lgt = 2 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 19 1 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 21 1 0 2 0 1 lgt = Empty matrix: 1-by-0 lgt = 2 2 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 23 1 0 2 0 1 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 25 1 0 2 0 1 0 2 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 1 2 1 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 27 1 0 2 0 1 0 2 0 1 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 2 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 29 1 0 2 0 1 0 2 0 1 0 2 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 3 1 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 31 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 lgt = Empty matrix: 1-by-0 lgt = 2 1 1 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Column 33 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 2 4 1 2 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 35 2 0 4 lgt = Empty matrix: 1-by-0 lgt = 1 1 2 2 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 37 2 0 4 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 39 2 0 4 0 2 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 3 7 7 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 41 2 0 4 0 2 0 1 0 7 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 1 1 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 43 2 0 4 0 2 0 1 0 7 0 1 lgt = Empty matrix: 1-by-0 lgt = 1 2 2 1 1 1 1 2 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 45 2 0 4 0 2 0 1 0 7 0 1 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 1 2 1 2 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 47 2 0 4 0 2 0 1 0 7 0 1 0 2 0 2 lgt = Empty matrix: 1-by-0 lgt = 4 2 1 1 2 3 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 48 2 0 4 0 2 0 1 0 7 0 1 0 2 0 2 0 Column 49 4 lgt = Empty matrix: 1-by-0 lgt = 2 2 1 2 1 1 2 2 2 1 1 1 1 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 48 2 0 4 0 2 0 1 0 7 0 1 0 2 0 2 0 Columns 49 through 51 4 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 1 3 1 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 48 2 0 4 0 2 0 1 0 7 0 1 0 2 0 2 0 Columns 49 through 53 4 0 2 0 3 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 1 1 1 1 1 2 1 1 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 48 2 0 4 0 2 0 1 0 7 0 1 0 2 0 2 0 Columns 49 through 55 4 0 2 0 3 0 2 lgt = Empty matrix: 1-by-0 lgt = 2 1 1 1 1 2 1 1 1 2 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 48 2 0 4 0 2 0 1 0 7 0 1 0 2 0 2 0 Columns 49 through 57 4 0 2 0 3 0 2 0 2 lgt = Empty matrix: 1-by-0 lgt = 1 1 1 1 3 1 1 2 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 48 2 0 4 0 2 0 1 0 7 0 1 0 2 0 2 0 Columns 49 through 59 4 0 2 0 3 0 2 0 2 0 3 lgt = Empty matrix: 1-by-0 lgt = 1 4 3 2 1 1 1 2 1 1 1 1 maximum = Columns 1 through 16 0 0 0 0 1 0 3 0 1 0 1 0 3 0 1 0 Columns 17 through 32 1 0 2 0 1 0 2 0 1 0 2 0 2 0 3 0 Columns 33 through 48 2 0 4 0 2 0 1 0 7 0 1 0 2 0 2 0 Columns 49 through 61 4 0 2 0 3 0 2 0 2 0 3 0 4 lgt = Empty matrix: 1-by-0 lgt = 2 1 1 1 1 1 2 1 1 1 1 maxi...

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!