Cody

Problem 45423. Bernoulli's Triangle

Solution 2933827

Submitted on 10 Sep 2020 by Alfonso Nieto-Castanon
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
x = [1 0 0 0 0 1 2 0 0 0 1 3 4 0 0 1 4 7 8 0 1 5 11 15 16] assert(isequal(bernoulli_tri(5),x))

x = 1 0 0 0 0 1 2 0 0 0 1 3 4 0 0 1 4 7 8 0 1 5 11 15 16

2   Pass
x = [1 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 1 3 4 0 0 0 0 0 0 0 1 4 7 8 0 0 0 0 0 0 1 5 11 15 16 0 0 0 0 0 1 6 16 26 31 32 0 0 0 0 1 7 22 42 57 63 64 0 0 0 1 8 29 64 99 120 127 128 0 0 1 9 37 93 163 219 247 255 256 0 1 10 46 130 256 382 466 502 511 512] assert(isequal(bernoulli_tri(10),x))

x = 1 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 1 3 4 0 0 0 0 0 0 0 1 4 7 8 0 0 0 0 0 0 1 5 11 15 16 0 0 0 0 0 1 6 16 26 31 32 0 0 0 0 1 7 22 42 57 63 64 0 0 0 1 8 29 64 99 120 127 128 0 0 1 9 37 93 163 219 247 255 256 0 1 10 46 130 256 382 466 502 511 512

3   Pass
x = [1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 1 3 4 0 0 0 0 0 0 0 0 0 0 1 4 7 8 0 0 0 0 0 0 0 0 0 1 5 11 15 16 0 0 0 0 0 0 0 0 1 6 16 26 31 32 0 0 0 0 0 0 0 1 7 22 42 57 63 64 0 0 0 0 0 0 1 8 29 64 99 120 127 128 0 0 0 0 0 1 9 37 93 163 219 247 255 256 0 0 0 0 1 10 46 130 256 382 466 502 511 512 0 0 0 1 11 56 176 386 638 848 968 1013 1023 1024 0 0 1 12 67 232 562 1024 1486 1816 1981 2036 2047 2048 0 1 13 79 299 794 1586 2510 3302 3797 4017 4083 4095 4096] assert(isequal(bernoulli_tri(13),x))

x = 1 0 0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 1 3 4 0 0 0 0 0 0 0 0 0 0 1 4 7 8 0 0 0 0 0 0 0 0 0 1 5 11 15 16 0 0 0 0 0 0 0 0 1 6 16 26 31 32 0 0 0 0 0 0 0 1 7 22 42 57 63 64 0 0 0 0 0 0 1 8 29 64 99 120 127 128 0 0 0 0 0 1 9 37 93 163 219 247 255 256 0 0 0 0 1 10 46 130 256 382 466 502 511 512 0 0 0 1 11 56 176 386 638 848 968 1013 1023 1024 0 0 1 12 67 232 562 1024 1486 1816 1981 2036 2047 2048 0 1 13 79 299 794 1586 2510 3302 3797 4017 4083 4095 4096

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!