Cody

# Problem 434. Return the Fibonacci Sequence

Solution 1809241

Submitted on 7 May 2019 by Parker Sheaffer
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
X = fib_seq(34); assert(isequal(X(end),21) && length(X)==8)

k = 3 h = 1 2 3 4 5 6 7 8 y = 1 1 2 3 5 8 13 21

2   Pass
X = fib_seq(35); assert(isequal(X(end),34) && length(X)==9)

k = 3 h = 1 2 3 4 5 6 7 8 9 y = 1 1 2 3 5 8 13 21 34

3   Pass
X = fib_seq(145); assert(isequal(X(end),144) && length(X)==12)

k = 3 h = 1 2 3 4 5 6 7 8 9 10 11 12 y = 1 1 2 3 5 8 13 21 34 55 89 144

4   Pass
X = fib_seq(4196); assert(isequal(X(end),4181) && length(X)==19)

k = 3 h = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 19 987 1597 2584 4181

5   Pass
X = fib_seq(987419996); assert(isequal(X(end),701408733) && length(X)==44)

k = 3 h = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 44 31 32 33 34 35 36 37 38 39 40 41 42 43 44 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 44 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 701408733

6   Pass
X = fib_seq(1134903171); assert(isequal(X(end),1134903170) && length(X)==45)

k = 3 h = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 45 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 y = 1.0e+09 * Columns 1 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 19 through 36 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0002 0.0003 0.0005 0.0008 0.0013 0.0022 0.0035 0.0057 0.0092 0.0149 Columns 37 through 45 0.0242 0.0391 0.0632 0.1023 0.1656 0.2679 0.4335 0.7014 1.1349

7   Pass
X = fib_seq(98691443031971); assert(isequal(X(end),72723460248141) && length(X)==68)

k = 3 h = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 60 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 Columns 61 through 68 61 62 63 64 65 66 67 68 y = 1.0e+13 * Columns 1 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 19 through 36 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 37 through 54 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0002 0.0003 0.0005 0.0008 0.0013 0.0020 0.0033 0.0053 0.0086 Columns 55 through 68 0.0140 0.0226 0.0365 0.0591 0.0957 0.1548 0.2505 0.4053 0.6557 1.0610 1.7168 2.7778 4.4946 7.2723
The text passage contains a series of test cases for a function that generates the Fibonacci sequence up to a specified number. Each test case includes an input value and an assertion to check the last number in the sequence and the length of the sequence.
multiple_questions_with_answers
Given a text passage, determine:
    1. If it contains a mathematical question (including word problems or calculations)
    2. If an answer to that mathematical question is provided in the text

First, describe the content structure you found in 1-2 sentences.

Then provide your analysis in the following format:
TYPE: <one of the following values>
- NO_QUESTION
- SINGLE_QUESTION
- SINGLE_QUESTION_WITH_ANSWER
- MULTIPLE_QUESTIONS
- MULTIPLE_QUESTIONS_WITH_ANSWERS
system
Cody

# Problem 434. Return the Fibonacci Sequence

Solution 1809241

Submitted on 7 May 2019 by Parker Sheaffer
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
X = fib_seq(34); assert(isequal(X(end),21) && length(X)==8)

k = 3 h = 1 2 3 4 5 6 7 8 y = 1 1 2 3 5 8 13 21

2   Pass
X = fib_seq(35); assert(isequal(X(end),34) && length(X)==9)

k = 3 h = 1 2 3 4 5 6 7 8 9 y = 1 1 2 3 5 8 13 21 34

3   Pass
X = fib_seq(145); assert(isequal(X(end),144) && length(X)==12)

k = 3 h = 1 2 3 4 5 6 7 8 9 10 11 12 y = 1 1 2 3 5 8 13 21 34 55 89 144

4   Pass
X = fib_seq(4196); assert(isequal(X(end),4181) && length(X)==19)

k = 3 h = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 19 987 1597 2584 4181

5   Pass
X = fib_seq(987419996); assert(isequal(X(end),701408733) && length(X)==44)

k = 3 h = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 44 31 32 33 34 35 36 37 38 39 40 41 42 43 44 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 44 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 701408733

6   Pass
X = fib_seq(1134903171); assert(isequal(X(end),1134903170) && length(X)==45)

k = 3 h = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 45 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 y = 1.0e+09 * Columns 1 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 19 through 36 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0002 0.0003 0.0005 0.0008 0.0013 0.0022 0.0035 0.0057 0.0092 0.0149 Columns 37 through 45 0.0242 0.0391 0.0632 0.1023 0.1656 0.2679 0.4335 0.7014 1.1349

7   Pass
X = fib_seq(98691443031971); assert(isequal(X(end),72723460248141) && length(X)==68)

k = 3 h = Columns 1 through 30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 60 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 Columns 61 through 68 61 62 63 64 65 66 67 68 y = 1.0e+13 * Columns 1 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 19 through 36 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 37 through 54 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0002 0.0003 0.0005 0.0008 0.0013 0.0020 0.0033 0.0053 0.0086 Columns 55 through 68 0.0140 0.0226 0.0365 0.0591 0.0957 0.1548 0.2505 0.4053 0.6557 1.0610 1.7168 2.7778 4.4946 7.2723
user
The text passage contains a series of test cases for a function that generates the Fibonacci sequence up to a specified number. Each test case includes an input value and an assertion to check the last number in the sequence and the length of the sequence.

TYPE: MULTIPLE_QUESTIONS_WITH_ANSWERS