Cody

# Problem 43754. Lah Numbers

Solution 2241507

Submitted on 28 Apr 2020
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   Fail
x = 8; y_correct = [1,0,0,0,0,0,0,0,0;2,1,0,0,0,0,0,0,0;6,6,1,0,0,0,0,0,0;24,36,12,1,0,0,0,0,0;120,240,120,20,1,0,0,0,0;720,1800,1200,300,30,1,0,0,0;5040,15120,12600,4200,630,42,1,0,0;40320,141120,141120,58800,11760,1176,56,1,0;362880,1451520,1693440,846720,211680,28224,2016,72,1]; assert(isequal(lah(x),y_correct))

Unrecognized function or variable 'k'. Error in lah (line 6) y(i,j)=nchoosek(n-1,k-1)*factorial(i)/factorial(j); Error in Test1 (line 3) assert(isequal(lah(x),y_correct))

2   Fail
x = 1; y_correct = [1,0;2,1]; assert(isequal(lah(x),y_correct))

Unrecognized function or variable 'k'. Error in lah (line 6) y(i,j)=nchoosek(n-1,k-1)*factorial(i)/factorial(j); Error in Test2 (line 3) assert(isequal(lah(x),y_correct))

3   Fail
x = 3; y_correct = [1,0,0,0;2,1,0,0;6,6,1,0;24,36,12,1]; assert(isequal(lah(x),y_correct))

Unrecognized function or variable 'k'. Error in lah (line 6) y(i,j)=nchoosek(n-1,k-1)*factorial(i)/factorial(j); Error in Test3 (line 3) assert(isequal(lah(x),y_correct))

4   Fail
x = 10; y_correct = [1,0,0,0,0,0,0,0,0,0,0;2,1,0,0,0,0,0,0,0,0,0;6,6,1,0,0,0,0,0,0,0,0;24,36,12,1,0,0,0,0,0,0,0;120,240,120,20,1,0,0,0,0,0,0;720,1800,1200,300,30,1,0,0,0,0,0;5040,15120,12600,4200,630,42,1,0,0,0,0;40320,141120,141120,58800,11760,1176,56,1,0,0,0;362880,1451520,1693440,846720,211680,28224,2016,72,1,0,0;3628800,16329600,21772800,12700800,3810240,635040,60480,3240,90,1,0;39916800,199584000,299376000,199584000,69854400,13970880,1663200,118800,4950,110,1]; assert(isequal(lah(x),y_correct))

Unrecognized function or variable 'k'. Error in lah (line 6) y(i,j)=nchoosek(n-1,k-1)*factorial(i)/factorial(j); Error in Test4 (line 3) assert(isequal(lah(x),y_correct))

### Community Treasure Hunt

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

Start Hunting!