Cody

# Problem 44705. Expand 10^n to Powers of 4

Solution 2771563

Submitted on 3 Aug 2020 by Jurjen Hendriks
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)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

### Community Treasure Hunt

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

Start Hunting!