Cody

Solution 1608779

Submitted on 14 Aug 2018
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 = 0; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

ans = 1

2   Pass
n = 1; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

ans = 2 2

3   Fail
n = 2; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

ans = 1 2 1 0

Error using dot (line 33) A and B must be same size. Error in Test3 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

4   Fail
n = 3; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

ans = 3 3 2 2 0

Error using dot (line 33) A and B must be same size. Error in Test4 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

5   Fail
n = 4; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

ans = 2 1 3 0 1 0 0

Error using dot (line 33) A and B must be same size. Error in Test5 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

6   Fail
n = 5; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

ans = 1 2 0 1 2 2 2 0 0

Error using dot (line 33) A and B must be same size. Error in Test6 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

7   Fail
n = 6; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n)& isequal(coeff(1),coeff(end)) & coeff(1)>0)

ans = 3 3 1 0 0 2 1 0 0 0

Error using dot (line 33) A and B must be same size. Error in Test7 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n)& isequal(coeff(1),coeff(end)) & coeff(1)>0)

8   Fail
n = 7; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

ans = 2 1 2 0 2 1 1 2 2 0 0 0

Error using dot (line 33) A and B must be same size. Error in Test8 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

9   Fail
n = 8; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

ans = 1 1 3 3 1 1 3 2 0 1 0 0 0 0

Error using dot (line 33) A and B must be same size. Error in Test9 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

10   Fail
n = 9; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

ans = 3 2 3 2 1 2 2 3 0 2 2 0 0 0 0

Error using dot (line 33) A and B must be same size. Error in Test10 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

11   Fail
n = 10; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

ans = 2 1 1 1 0 0 0 2 3 3 2 1 0 0 0 0 0

Error using dot (line 33) A and B must be same size. Error in Test11 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

12   Fail
n = 11; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

ans = 1 1 3 1 0 2 0 1 3 1 2 3 2 2 0 0 0 0 0

Error using dot (line 33) A and B must be same size. Error in Test12 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

13   Fail
n = 12; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

ans = 3 2 2 0 3 1 1 0 2 2 1 1 0 1 0 0 0 0 0 0

Error using dot (line 33) A and B must be same size. Error in Test13 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

14   Fail
n = 13; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

ans = 2 1 0 1 2 0 1 0 3 2 1 3 0 2 2 2 0 0 0 0 0 0

Error using dot (line 33) A and B must be same size. Error in Test14 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

15   Fail
n = 14; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

ans = 1 1 2 2 3 3 0 3 0 1 0 0 1 3 2 2 1 0 0 0 0 0 0 0

Error using dot (line 33) A and B must be same size. Error in Test15 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

16   Fail
n = 15; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

ans = 3 2 0 3 1 1 3 3 2 2 2 1 0 3 0 1 2 2 0 0 0 0 0 0 0

Error using dot (line 33) A and B must be same size. Error in Test16 (line 3) assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end))&coeff(1)>0)

17   Fail
n = 16; coeff = ten2pow4(n); assert(isequal(dot(coeff, 4.^flip(0:n)),10^n) & isequal(coeff(1),coeff(end)) & coeff(1)>0)

Error using dec2base (line 22) First argument must be an array of integers, 0 <= D <= flintmax. Error in ten2pow4 (line 2) dec2base(10^n,4) - '0' Error in Test17 (line 2) coeff = ten2pow4(n);