Cody

Problem 45229. Bell Triangle

Solution 2114869

Submitted on 2 Feb 2020 by Nikolaos Nikolaou
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(Bell_tri(n),y_correct))

y = 1

2   Pass
n = 5; y_correct = [1 0 0 0 0; 1 2 0 0 0; 2 3 5 0 0; 5 7 10 15 0; 15 20 27 37 52]; assert(isequal(Bell_tri(n),y_correct))

y = 1 0 0 0 0 y = 1 0 0 0 0 1 2 0 0 0 y = 1 0 0 0 0 1 2 0 0 0 2 3 5 0 0 y = 1 0 0 0 0 1 2 0 0 0 2 3 5 0 0 5 7 10 15 0 y = 1 0 0 0 0 1 2 0 0 0 2 3 5 0 0 5 7 10 15 0 15 20 27 37 52

3   Pass
n = 9; y_correct = [ 1 0 0 0 0 0 0 0 0; 1 2 0 0 0 0 0 0 0; 2 3 5 0 0 0 0 0 0; 5 7 10 15 0 0 0 0 0; 15 20 27 37 52 0 0 0 0; 52 67 87 114 151 203 0 0 0; 203 255 322 409 523 674 877 0 0; 877 1080 1335 1657 2066 2589 3263 4140 0; 4140 5017 6097 7432 9089 11155 13744 17007 21147]; assert(isequal(Bell_tri(n),y_correct))

y = 1 0 0 0 0 0 0 0 0 y = 1 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 y = 1 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 2 3 5 0 0 0 0 0 0 y = 1 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 2 3 5 0 0 0 0 0 0 5 7 10 15 0 0 0 0 0 y = 1 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 2 3 5 0 0 0 0 0 0 5 7 10 15 0 0 0 0 0 15 20 27 37 52 0 0 0 0 y = 1 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 2 3 5 0 0 0 0 0 0 5 7 10 15 0 0 0 0 0 15 20 27 37 52 0 0 0 0 52 67 87 114 151 203 0 0 0 y = 1 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 2 3 5 0 0 0 0 0 0 5 7 10 15 0 0 0 0 0 15 20 27 37 52 0 0 0 0 52 67 87 114 151 203 0 0 0 203 255 322 409 523 674 877 0 0 y = 1 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 2 3 5 0 0 0 0 0 0 5 7 10 15 0 0 0 0 0 15 20 27 37 52 0 0 0 0 52 67 87 114 151 203 0 0 0 203 255 322 409 523 674 877 0 0 877 1080 1335 1657 2066 2589 3263 4140 0 y = 1 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 2 3 5 0 0 0 0 0 0 5 7 10 15 0 0 0 0 0 15 20 27 37 52 0 0 0 0 52 67 87 114 151 203 0 0 0 203 255 322 409 523 674 877 0 0 877 1080 1335 1657 2066 2589 3263 4140 0 4140 5017 6097 7432 9089 11155 13744 17007 21147

Suggested Problems

More from this Author149

Community Treasure Hunt

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

Start Hunting!