Cody

Problem 45248. Aquiles y la tortuga

Solution 2073624

Submitted on 29 Dec 2019 by Tim
  • Size: 15
  • This is the leading solution.
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 = 3; suma = [1/2 (1/2+1/4) (1/2+1/4+1/8)]; assert(isequal(mi_funcion(n),suma));

ans = 0.5000 0.7500 0.8750

2   Pass
n = 4; suma = [1/2 (1/2+1/4) (1/2+1/4+1/8) (1/2+1/4+1/8+1/16)]; assert(isequal(mi_funcion(n),suma))

ans = 0.5000 0.7500 0.8750 0.9375

3   Pass
n = 6; suma = [1/2 (1/2+1/4) (1/2+1/4+1/8) (1/2+1/4+1/8+1/16) (1/2+1/4+1/8+1/16+1/32) (1/2+1/4+1/8+1/16+1/32+1/64)]; assert(isequal(mi_funcion(n),suma))

ans = 0.5000 0.7500 0.8750 0.9375 0.9688 0.9844

4   Pass
n = 10; suma = [1/2 (1/2+1/4) (1/2+1/4+1/8) (1/2+1/4+1/8+1/16) (1/2+1/4+1/8+1/16+1/32) (1/2+1/4+1/8+1/16+1/32+1/64) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7+1/2^8) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7+1/2^8+1/2^9) (1/2+1/4+1/8+1/16+1/32+1/64+1/2^7+1/2^8+1/2^9+1/2^10)]; assert(isequal(mi_funcion(n),suma))

ans = 0.5000 0.7500 0.8750 0.9375 0.9688 0.9844 0.9922 0.9961 0.9980 0.9990

Suggested Problems

More from this Author1

Community Treasure Hunt

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

Start Hunting!