Cody

Problem 46034. Construct the Seidel-Entringer-Arnold triangle

Solution 2676995

Submitted on 10 Jul 2020 by William
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 = 1; y_correct = 1; assert(isequal(SeidelEntringerArnold(n),y_correct))

2   Pass
n = 3; y_correct = [1 1 0]; assert(isequal(SeidelEntringerArnold(n),y_correct))

3   Pass
n = 5; y_correct = [5 5 4 2 0]; assert(isequal(SeidelEntringerArnold(n),y_correct))

4   Pass
n = 8; y_correct = [0 61 122 178 224 256 272 272]; assert(isequal(SeidelEntringerArnold(n),y_correct))

5   Pass
n = 13; y_correct = [2702765 2702765 2652244 2551202 2401024 2204480 1965664 1689872 1383424 1053440 707584 353792 0]; assert(isequal(SeidelEntringerArnold(n),y_correct))

6   Pass
n = 10; y = SeidelEntringerArnold(n); s = sum(y); v = round(var(y)); d = y([4 6 9]) - y([2 5 7]); s_correct = 50521; v_correct = 8277369; d_correct = [2709 1024 816]; assert(isequal(s,s_correct) && isequal(v,v_correct) && isequal(d,d_correct))

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!