Cody

# Problem 656. Calculate Euler's phi function

Solution 1961997

Submitted on 6 Oct 2019
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
y_correct = [ 1, 1, 2, 2, 4, 2, 6, 4, 6, 4, 10, ... 4, 12, 6, 8, 8, 16, 6, 18, 8, 12, ... 10, 22, 8, 20, 12, 18, 12, 28, 8, ... 30, 16, 20, 16, 24, 12, 36, 18, 24, ... 16, 40, 12, 42, 20, 24, 22, 46, 16, ... 42, 20, 32, 24, 52, 18, 40, 24, 36, 28, ... 58, 16, 60, 30, 36, 32, 48, 20, 66, 32, ... 44, 24, 70, 24, 72, 36, 40, 36, 60, 24, ... 78, 32, 54, 40, 82, 24, 64, 42, 56, 40, ... 88, 24, 72, 44, 60, 46, 72, 32, 96, 42, 60]; assert(isequal(eulerphi(1:99),y_correct))

phi = 1.0e+134 * Columns 1 through 18 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 Columns 19 through 36 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 Columns 37 through 54 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 Columns 55 through 72 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 Columns 73 through 90 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 0 0.0000 0 -0.0000 Columns 91 through 99 0 0.0000 0 -0.0000 0 0.0019 0 -7.2365 0

Assertion failed.

2   Fail
assert(isequal(eulerphi(double(intmax('int16'))), 27000)) assert(isequal(eulerphi(double(intmax('uint16'))),32768))

phi = 0

Assertion failed.

3   Fail
assert(isequal(eulerphi(double(intmax('int32'))), 2147483646)) assert(isequal(eulerphi(double(intmax('uint32'))),2147483648))

phi = 0

Assertion failed.