Cody

Problem 44705. Expand 10^n to Powers of 4

Solution 2950141

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

Assertion failed.

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)

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

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)

Assertion failed.

Suggested Problems

More from this Author18

Community Treasure Hunt

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

Start Hunting!