Cody

# Problem 46571. Characterize the final state of the digit inventory sequence

Solution 2988379

Submitted on 24 Sep 2020 by Rafael S.T. Vieira
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
y1 = 24; n_correct = 7; period_correct = 1; [n,period] = digInvFinalState(y1); assert(isequal(n,n_correct) && isequal(period,period_correct))

2   Pass
y1 = 210; n_correct = 10; period_correct = 2; [n,period] = digInvFinalState(y1); assert(isequal(n,n_correct) && isequal(period,period_correct))

3   Pass
y1 = 1; n_correct = 13; period_correct = 1; [n,period] = digInvFinalState(y1); assert(isequal(n,n_correct) && isequal(period,period_correct))

4   Pass
y1 = 10; n_correct = 10; period_correct = 1; [n,period] = digInvFinalState(y1); assert(isequal(n,n_correct) && isequal(period,period_correct))

5   Pass
y1 = 22; n_correct = 1; period_correct = 1; [n,period] = digInvFinalState(y1); assert(isequal(n,n_correct) && isequal(period,period_correct))

6   Pass
y1 = 40; n_correct = 10; period_correct = 2; [n,period] = digInvFinalState(y1); assert(isequal(n,n_correct) && isequal(period,period_correct))

7   Pass
y1 = 50; n_correct = 11; period_correct = 3; [n,period] = digInvFinalState(y1); assert(isequal(n,n_correct) && isequal(period,period_correct))

8   Pass
for y1 = 567:571 [n(y1-566),period(y1-566)] = digInvFinalState(y1); end prod_correct = 136; assert(isequal(n*period',prod_correct));

### Community Treasure Hunt

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

Start Hunting!