Cody

Problem 46087. Investigate the frequency of last non-zero digits of primorials

Solution 2778787

Submitted on 4 Aug 2020 by William
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 = 10; f_correct = [0.3333 0.3333 0 0.3333; 0.6667 0.3333 0 0; 0 1.0000 0 0; 0 0 1.0000 0]; assert(isequal(round(primorialLastNZDigitFreq(n),4),f_correct))

2   Pass
n = 100; f_correct = [0.1923 0.2308 0.3077 0.2692; 0.3636 0.2273 0.1818 0.2273; 0.2800 0.2800 0.2400 0.2000; 0.2400 0.1600 0.2800 0.3200]; assert(isequal(round(primorialLastNZDigitFreq(n),4),f_correct))

3   Pass
n = 1000; f_correct = [0.2394 0.2625 0.2432 0.2548; 0.3095 0.2460 0.2143 0.2302; 0.2389 0.2672 0.2551 0.2389; 0.2500 0.2292 0.2792 0.2417]; assert(isequal(round(primorialLastNZDigitFreq(n),4),f_correct))

4   Pass
n = 1e4; f_correct = [0.2426 0.2512 0.2471 0.2590; 0.2551 0.2544 0.2385 0.2520; 0.2374 0.2602 0.2466 0.2558; 0.2394 0.2453 0.2654 0.2500]; assert(isequal(round(primorialLastNZDigitFreq(n),4),f_correct))

5   Pass
n = 1e6; f_correct = [0.2489 0.2493 0.2509 0.2509; 0.2505 0.2506 0.2484 0.2505; 0.2499 0.2505 0.2504 0.2492; 0.2500 0.2494 0.2507 0.2498]; assert(isequal(round(primorialLastNZDigitFreq(n),4),f_correct))