Cody

Problem 46057. Find the last non-zero digit in a primorial

Solution 2785399

Submitted on 5 Aug 2020 by Jean-Marie Sainthillier
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 = 2; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

2   Pass
n = 2; y_correct = 6; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

3   Pass
n = 3; y_correct = 3; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

4   Pass
n = 4; y_correct = 1; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

5   Pass
n = 12; y_correct = 1; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

6   Pass
n = 29; y_correct = 3; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

7   Pass
n = 53; y_correct = 3; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

8   Pass
n = 89; y_correct = 7; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

9   Pass
n = 163; y_correct = 3; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

10   Pass
n = 211; y_correct = 1; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

11   Pass
n = 254; y_correct = 9; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

12   Pass
n = 350; y_correct = 7; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

13   Pass
n = 1379; y_correct = 3; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

14   Pass
n = 37913; y_correct = 3; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

15   Pass
n = 1379137; y_correct = 9; assert(isequal(primorialLastNonzeroDigit(n),y_correct))

Suggested Problems

More from this Author46

Community Treasure Hunt

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

Start Hunting!