Cody

# Problem 2248. Bell Number calculator

Solution 3329998

Submitted on 22 Oct 2020 by Jerry Wright
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 = 0; y_correct = 1; assert(isequal(Belln(n),y_correct))

x = 1 y = 1

2   Pass
n = 5; y_correct = [1 1 2 5 15 52]; assert(isequal(Belln(n),y_correct))

x = 1 y = 1 x = 1 1 x = 1 0 1 2 r = 1 y = 1 1 x = 1 0 1 2 2 0 x = 1 0 1 2 2 3 r = 2 x = 1 0 0 1 2 0 2 3 5 y = 1 1 2 x = 1 0 0 1 2 0 2 3 5 5 0 0 x = 1 0 0 1 2 0 2 3 5 5 7 0 r = 3 x = 1 0 0 1 2 0 2 3 5 5 7 10 x = 1 0 0 0 1 2 0 0 2 3 5 0 5 7 10 15 y = 1 1 2 5 x = 1 0 0 0 1 2 0 0 2 3 5 0 5 7 10 15 15 0 0 0 x = 1 0 0 0 1 2 0 0 2 3 5 0 5 7 10 15 15 20 0 0 r = 4 x = 1 0 0 0 1 2 0 0 2 3 5 0 5 7 10 15 15 20 27 0 x = 1 0 0 0 1 2 0 0 2 3 5 0 5 7 10 15 15 20 27 37 x = 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 y = 1 1 2 5 15 x = 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 52 0 0 0 0 x = 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 52 67 0 0 0 r = 5 x = 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 52 67 87 0 0 x = 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 52 67 87 114 0 x = 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 52 67 87 114 151 x = 1 0 0 0 0 0 1 2 0 0 0 0 2 3 5 0 0 0 5 7 10 15 0 0 15 20 27 37 52 0 52 67 87 114 151 203 y = 1 1 2 5 15 52

3   Pass
n = 9; y_correct = [1 1 2 5 15 52 203 877 4140 21147]; assert(isequal(Belln(n),y_correct))

x = 1 y = 1 x = 1 1 x = 1 0 1 2 r = 1 y = 1 1 x = 1 0 1 2 2 0 x = 1 0 1 2 2 3 r = 2 x = 1 0 0 1 2 0 2 3 5 y = 1 1 2 x = 1 0 0 1 2 0 2 3 5 5 0 0 x = 1 0 0 1 2 0 2 3 5 5 7 0 r = 3 x = 1 0 0 1 2 0 2 3 5 5 7 10 x = 1 0 0 0 1 2 0 0 2 3 5 0 5 7 10 15 y = 1 1 2 5 x = 1 0 0 0 1 2 0 0 2 3 5 0 5 7 10 15 15 0 0 0 x = 1 0 0 0 1 2 0 0 2 3 5 0 5 7 10 15 15 20 0 0 r = 4 x = 1 0 0 0 1 2 0 0 2 3 5 0 5 7 10 15 15 20 27 0 x = 1 0 0 0 1 2 0 0 2 3 5 0 5 7 10 15 15 20 27 37 x = 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 y = 1 1 2 5 15 x = 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 52 0 0 0 0 x = 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 52 67 0 0 0 r = 5 x = 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 52 67 87 0 0 x = 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 52 67 87 114 0 x = 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 52 67 87 114 151 x = 1 0 0 0 0 0 1 2 0 0 0 0 2 3 5 0 0 0 5 7 10 15 0 0 15 20 27 37 52 0 52 67 87 114 151 203 y = 1 1 2 5 15 52 x = 1 0 0 0 0 0 1 2 0 0 0 0 2 3 5 0 0 0 5 7 10 15 0 0 15 20 27 37 52 0 52 67 87 114 151 203 203 0 0 0 0 0 x = 1 0 0 0 0 0 1 2 0 0 0 0 2 3 5 0 0 0 5 7 10 15 0 0 15 20 27 37 52 0 52 67 87 114 151 203 203 255 0 0 0 0 r = 6 x = 1 0 0 0 0 0 1 2 0 0 0 0 2 3 5 0 0 0 5 7 10 15 0 0 15 20 27 37 52 0 52 67 87 114 151 203 203 255 322 0 0 0 x = 1 0 0 0 0 0 1 2 0 0 0 0 2 3 5 0 0 0 5 7 10 15 0 0 15 20 27 37 52 0 52 67 87 114 151 203 203 255 322 409 0 0 x = 1 0 0 0 0 0 1 2 0 0 0 0 2 3 5 0 0 0 5 7 10 15 0 0 15 20 27 37 52 0 52 67 87 114 151 203 203 255 322 409 523 0 x = 1 0 0 0 0 0 1 2 0 0 0 0 2 3 5 0 0 0 5 7 10 15 0 0 15 20 27 37 52 0 52 67 87 114 151 203 203 255 322 409 523 674 x = 1 0 0 0 0 0 0 1 2 0 0 0 0 0 2 3 5 0 0 0 0 5 7 10 15 0 0 0 15 20 27 37 52 0 0 52 67 87 114 151 203 0 203 255 322 409 523 674 877 y = 1 1 2 5 15 52 203 x = 1 0 0 0 0 0 0 1 2 0 0 0 0 0 2 3 5 0 0 0 0 5 7 10 15 0 0 0 15 20 27 37 52 0 0 52 67 87 114 151 203 0 203 255 322 409 523 674 877 877 0 0 0 0 0 0 x = 1 0 0 0 0 0 0 1 2 0 0 0 0 0 2 3 5 0 0 0 0 5 7 10 15 0 0 0 15 20 27 37 52 0 0 52 67 87 114 151 203 0 203 255 322 409 523 674 877 877 1080 0 0 0 0 0 r = 7 x = 1 0 0 0 0 0 0 1 2 0 0 0 0 0 2 3 5 0 0 0 0 5 7 10 15 0 0 0 15 20 27 37 52 0 0 52 67 87 114 151 203 0 203 255 322 409 523 674 877 877 1080 1335 0 0 0 0 x = 1 0 0 0 0 0 0 1 2 0 0 0 0 0 2 3 5 0 0 0 0 5 7 10 15 0 0 0 15 20 27 37 52 0 0 52 67 87 114 151 203 0 203 255 322 409 523 674 877 877 1080 1335 1657 0 0 0 x = 1 0 0 0 0 0 0 1 2 0 0 0 0 0 2 3 5 0 0 0 0 5 7 10 15 0 0 0 15 20 27 37 52 0 0 52 67 87 114 151 203 0 203 255 322 409 523 674 877 877 1080 1335 1657 2066 0 0 x = 1 0 0 0 0 0 0 1 2 0 0 0 0 0 2 3 5 0 0 0 0 5 7 10 15 0 0 0 15 20 27 37 52 0 0 52 67 87 114 151 203 0 203 255 322 409 523 674 877 877 1080 1335 1657 2066 2589 0 x = 1 0 0 0 0 0 0 1 2 0 0 0 0 0 2 3 5 0 0 0 0 5 7 10 15 0 0 0 15 20 27 37 52 0 0 52 67 87 114 151 203 0 203 255 322 409 523 674 877 877 1080 1335 1657 2066 2589 3263 x = 1 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 2 3 5 0 0 0 0 0 5 7 10 15 0 0 0 0 15 20 27 37 52 0 0 0 52 67 87 114 151 203 0 0 203 255 322 409 523 674 877 0 877 1080 1335 1657 2066 2589 3263 4140 y = 1 1 2 5 15 52 203 877 ...

### Community Treasure Hunt

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

Start Hunting!