Cody

# Problem 43016. Find the next Fibonacci number

Solution 1944840

Submitted on 21 Sep 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
n = 6; out = 8; assert(isequal(next_fibonacci(n),out));

y = 8.0000 y = 8.0000 13.0000

Assertion failed.

2   Fail
n = [12 40 50]; out = [13 55 55]; assert(isequal(next_fibonacci(n),out));

y = 13.0000 y = 13.0000 21.0000 y = 13.0000 21.0000 55.0000 y = 13.0000 21.0000 55.0000 89.0000 y = 13.0000 21.0000 55.0000 89.0000 55.0000 y = 13.0000 21.0000 55.0000 89.0000 55.0000 89.0000

Assertion failed.

3   Fail
n = 10.^(1:5); out = [13 144 1597 10946 121393]; assert(isequal(next_fibonacci(n),out));

y = 13.0000 y = 13.0000 21.0000 y = 13.0000 21.0000 144.0000 y = 13.0000 21.0000 144.0000 233.0000 y = 1.0e+03 * 0.0130 0.0210 0.1440 0.2330 1.5970 y = 1.0e+03 * 0.0130 0.0210 0.1440 0.2330 1.5970 2.5840 y = 1.0e+04 * 0.0013 0.0021 0.0144 0.0233 0.1597 0.2584 1.0946 y = 1.0e+04 * 0.0013 0.0021 0.0144 0.0233 0.1597 0.2584 1.0946 1.7711 y = 1.0e+05 * 0.0001 0.0002 0.0014 0.0023 0.0160 0.0258 0.1095 0.1771 1.2139 y = 1.0e+05 * 0.0001 0.0002 0.0014 0.0023 0.0160 0.0258 0.1095 0.1771 1.2139 1.9642

Assertion failed.

4   Fail
n = round(7.^(3:.5:7)); out = [377 987 2584 6765 17711 46368 121393 317811 832040]; assert(isequal(next_fibonacci(n),out));

y = 377.0000 y = 377.0000 610.0000 y = 377.0000 610.0000 987.0000 y = 1.0e+03 * 0.3770 0.6100 0.9870 1.5970 y = 1.0e+03 * 0.3770 0.6100 0.9870 1.5970 2.5840 y = 1.0e+03 * 0.3770 0.6100 0.9870 1.5970 2.5840 4.1810 y = 1.0e+03 * 0.3770 0.6100 0.9870 1.5970 2.5840 4.1810 6.7650 y = 1.0e+04 * 0.0377 0.0610 0.0987 0.1597 0.2584 0.4181 0.6765 1.0946 y = 1.0e+04 * 0.0377 0.0610 0.0987 0.1597 0.2584 0.4181 0.6765 1.0946 1.7711 y = 1.0e+04 * 0.0377 0.0610 0.0987 0.1597 0.2584 0.4181 0.6765 1.0946 1.7711 2.8657 y = 1.0e+04 * 0.0377 0.0610 0.0987 0.1597 0.2584 0.4181 0.6765 1.0946 1.7711 2.8657 4.6368 y = 1.0e+04 * 0.0377 0.0610 0.0987 0.1597 0.2584 0.4181 0.6765 1.0946 1.7711 2.8657 4.6368 7.5025 y = 1.0e+05 * 0.0038 0.0061 0.0099 0.0160 0.0258 0.0418 0.0677 0.1095 0.1771 0.2866 0.4637 0.7503 1.2139 y = 1.0e+05 * 0.0038 0.0061 0.0099 0.0160 0.0258 0.0418 0.0677 0.1095 0.1771 0.2866 0.4637 0.7503 1.2139 1.9642 y = 1.0e+05 * 0.0038 0.0061 0.0099 0.0160 0.0258 0.0418 0.0677 0.1095 0.1771 0.2866 0.4637 0.7503 1.2139 1.9642 3.1781 y = 1.0e+05 * 0.0038 0.0061 0.0099 0.0160 0.0258 0.0418 0.0677 0.1095 0.1771 0.2866 0.4637 0.7503 1.2139 1.9642 3.1781 5.1423 y = 1.0e+05 * 0.0038 0.0061 0.0099 0.0160 0.0258 0.0418 0.0677 0.1095 0.1771 0.2866 0.4637 0.7503 1.2139 1.9642 3.1781 5.1423 8.3204 y = 1.0e+06 * 0.0004 0.0006 0.0010 0.0016 0.0026 0.0042 0.0068 0.0109 0.0177 0.0287 0.0464 0.0750 0.1214 0.1964 0.3178 0.5142 0.8320 1.3463

Assertion failed.