01How Computers Work (online)

Fully solved problem book

Fibonacci state traces

Set 1 of 3 · 32 worked questions. Predict your result before expanding the solution.

These worked traces are meant to build fluency through controlled variation. If several answers feel identical, try the next difficult value and look for the point where a carry, sign, branch, or selected memory address changes the outcome.

Sequential programs · Problem 0001

At Fibonacci iteration 0, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 0 begins with the pair of registers a=0, b=1.
  2. The current output is register a, so the emitted term is 0.
  3. Calculate a temporary sum t = a+b = 0+1 = 1.
  4. Copy the previous value of b into the new a register.
  5. The new a is 1.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 1.
  8. After the update, the pair is (1, 1).
  9. On the next iteration, the machine will emit 1.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 0; pair (1, 1)

Sequential programs · Problem 0002

At Fibonacci iteration 1, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 1 begins with the pair of registers a=1, b=1.
  2. The current output is register a, so the emitted term is 1.
  3. Calculate a temporary sum t = a+b = 1+1 = 2.
  4. Copy the previous value of b into the new a register.
  5. The new a is 1.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 2.
  8. After the update, the pair is (1, 2).
  9. On the next iteration, the machine will emit 1.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 1; pair (1, 2)

Sequential programs · Problem 0003

At Fibonacci iteration 2, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 2 begins with the pair of registers a=1, b=2.
  2. The current output is register a, so the emitted term is 1.
  3. Calculate a temporary sum t = a+b = 1+2 = 3.
  4. Copy the previous value of b into the new a register.
  5. The new a is 2.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 3.
  8. After the update, the pair is (2, 3).
  9. On the next iteration, the machine will emit 2.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 1; pair (2, 3)

Sequential programs · Problem 0004

At Fibonacci iteration 3, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 3 begins with the pair of registers a=2, b=3.
  2. The current output is register a, so the emitted term is 2.
  3. Calculate a temporary sum t = a+b = 2+3 = 5.
  4. Copy the previous value of b into the new a register.
  5. The new a is 3.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 5.
  8. After the update, the pair is (3, 5).
  9. On the next iteration, the machine will emit 3.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 2; pair (3, 5)

Sequential programs · Problem 0005

At Fibonacci iteration 4, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 4 begins with the pair of registers a=3, b=5.
  2. The current output is register a, so the emitted term is 3.
  3. Calculate a temporary sum t = a+b = 3+5 = 8.
  4. Copy the previous value of b into the new a register.
  5. The new a is 5.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 8.
  8. After the update, the pair is (5, 8).
  9. On the next iteration, the machine will emit 5.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 3; pair (5, 8)

Sequential programs · Problem 0006

At Fibonacci iteration 5, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 5 begins with the pair of registers a=5, b=8.
  2. The current output is register a, so the emitted term is 5.
  3. Calculate a temporary sum t = a+b = 5+8 = 13.
  4. Copy the previous value of b into the new a register.
  5. The new a is 8.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 13.
  8. After the update, the pair is (8, 13).
  9. On the next iteration, the machine will emit 8.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 5; pair (8, 13)

Sequential programs · Problem 0007

At Fibonacci iteration 6, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 6 begins with the pair of registers a=8, b=13.
  2. The current output is register a, so the emitted term is 8.
  3. Calculate a temporary sum t = a+b = 8+13 = 21.
  4. Copy the previous value of b into the new a register.
  5. The new a is 13.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 21.
  8. After the update, the pair is (13, 21).
  9. On the next iteration, the machine will emit 13.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 8; pair (13, 21)

Sequential programs · Problem 0008

At Fibonacci iteration 7, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 7 begins with the pair of registers a=13, b=21.
  2. The current output is register a, so the emitted term is 13.
  3. Calculate a temporary sum t = a+b = 13+21 = 34.
  4. Copy the previous value of b into the new a register.
  5. The new a is 21.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 34.
  8. After the update, the pair is (21, 34).
  9. On the next iteration, the machine will emit 21.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 13; pair (21, 34)

Sequential programs · Problem 0009

At Fibonacci iteration 8, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 8 begins with the pair of registers a=21, b=34.
  2. The current output is register a, so the emitted term is 21.
  3. Calculate a temporary sum t = a+b = 21+34 = 55.
  4. Copy the previous value of b into the new a register.
  5. The new a is 34.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 55.
  8. After the update, the pair is (34, 55).
  9. On the next iteration, the machine will emit 34.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 21; pair (34, 55)

Sequential programs · Problem 0010

At Fibonacci iteration 9, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 9 begins with the pair of registers a=34, b=55.
  2. The current output is register a, so the emitted term is 34.
  3. Calculate a temporary sum t = a+b = 34+55 = 89.
  4. Copy the previous value of b into the new a register.
  5. The new a is 55.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 89.
  8. After the update, the pair is (55, 89).
  9. On the next iteration, the machine will emit 55.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 34; pair (55, 89)

Sequential programs · Problem 0011

At Fibonacci iteration 10, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 10 begins with the pair of registers a=55, b=89.
  2. The current output is register a, so the emitted term is 55.
  3. Calculate a temporary sum t = a+b = 55+89 = 144.
  4. Copy the previous value of b into the new a register.
  5. The new a is 89.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 144.
  8. After the update, the pair is (89, 144).
  9. On the next iteration, the machine will emit 89.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 55; pair (89, 144)

Sequential programs · Problem 0012

At Fibonacci iteration 11, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 11 begins with the pair of registers a=89, b=144.
  2. The current output is register a, so the emitted term is 89.
  3. Calculate a temporary sum t = a+b = 89+144 = 233.
  4. Copy the previous value of b into the new a register.
  5. The new a is 144.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 233.
  8. After the update, the pair is (144, 233).
  9. On the next iteration, the machine will emit 144.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 89; pair (144, 233)

Sequential programs · Problem 0013

At Fibonacci iteration 12, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 12 begins with the pair of registers a=144, b=233.
  2. The current output is register a, so the emitted term is 144.
  3. Calculate a temporary sum t = a+b = 144+233 = 377.
  4. Copy the previous value of b into the new a register.
  5. The new a is 233.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 377.
  8. After the update, the pair is (233, 377).
  9. On the next iteration, the machine will emit 233.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 144; pair (233, 377)

Sequential programs · Problem 0014

At Fibonacci iteration 13, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 13 begins with the pair of registers a=233, b=377.
  2. The current output is register a, so the emitted term is 233.
  3. Calculate a temporary sum t = a+b = 233+377 = 610.
  4. Copy the previous value of b into the new a register.
  5. The new a is 377.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 610.
  8. After the update, the pair is (377, 610).
  9. On the next iteration, the machine will emit 377.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 233; pair (377, 610)

Sequential programs · Problem 0015

At Fibonacci iteration 14, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 14 begins with the pair of registers a=377, b=610.
  2. The current output is register a, so the emitted term is 377.
  3. Calculate a temporary sum t = a+b = 377+610 = 987.
  4. Copy the previous value of b into the new a register.
  5. The new a is 610.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 987.
  8. After the update, the pair is (610, 987).
  9. On the next iteration, the machine will emit 610.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 377; pair (610, 987)

Sequential programs · Problem 0016

At Fibonacci iteration 15, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 15 begins with the pair of registers a=610, b=987.
  2. The current output is register a, so the emitted term is 610.
  3. Calculate a temporary sum t = a+b = 610+987 = 1597.
  4. Copy the previous value of b into the new a register.
  5. The new a is 987.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 1597.
  8. After the update, the pair is (987, 1597).
  9. On the next iteration, the machine will emit 987.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 610; pair (987, 1597)

Sequential programs · Problem 0017

At Fibonacci iteration 16, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 16 begins with the pair of registers a=987, b=1597.
  2. The current output is register a, so the emitted term is 987.
  3. Calculate a temporary sum t = a+b = 987+1597 = 2584.
  4. Copy the previous value of b into the new a register.
  5. The new a is 1597.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 2584.
  8. After the update, the pair is (1597, 2584).
  9. On the next iteration, the machine will emit 1597.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 987; pair (1597, 2584)

Sequential programs · Problem 0018

At Fibonacci iteration 17, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 17 begins with the pair of registers a=1597, b=2584.
  2. The current output is register a, so the emitted term is 1597.
  3. Calculate a temporary sum t = a+b = 1597+2584 = 4181.
  4. Copy the previous value of b into the new a register.
  5. The new a is 2584.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 4181.
  8. After the update, the pair is (2584, 4181).
  9. On the next iteration, the machine will emit 2584.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 1597; pair (2584, 4181)

Sequential programs · Problem 0019

At Fibonacci iteration 18, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 18 begins with the pair of registers a=2584, b=4181.
  2. The current output is register a, so the emitted term is 2584.
  3. Calculate a temporary sum t = a+b = 2584+4181 = 6765.
  4. Copy the previous value of b into the new a register.
  5. The new a is 4181.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 6765.
  8. After the update, the pair is (4181, 6765).
  9. On the next iteration, the machine will emit 4181.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 2584; pair (4181, 6765)

Sequential programs · Problem 0020

At Fibonacci iteration 19, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 19 begins with the pair of registers a=4181, b=6765.
  2. The current output is register a, so the emitted term is 4181.
  3. Calculate a temporary sum t = a+b = 4181+6765 = 10946.
  4. Copy the previous value of b into the new a register.
  5. The new a is 6765.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 10946.
  8. After the update, the pair is (6765, 10946).
  9. On the next iteration, the machine will emit 6765.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 4181; pair (6765, 10946)

Sequential programs · Problem 0021

At Fibonacci iteration 20, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 20 begins with the pair of registers a=6765, b=10946.
  2. The current output is register a, so the emitted term is 6765.
  3. Calculate a temporary sum t = a+b = 6765+10946 = 17711.
  4. Copy the previous value of b into the new a register.
  5. The new a is 10946.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 17711.
  8. After the update, the pair is (10946, 17711).
  9. On the next iteration, the machine will emit 10946.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 6765; pair (10946, 17711)

Sequential programs · Problem 0022

At Fibonacci iteration 21, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 21 begins with the pair of registers a=10946, b=17711.
  2. The current output is register a, so the emitted term is 10946.
  3. Calculate a temporary sum t = a+b = 10946+17711 = 28657.
  4. Copy the previous value of b into the new a register.
  5. The new a is 17711.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 28657.
  8. After the update, the pair is (17711, 28657).
  9. On the next iteration, the machine will emit 17711.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 10946; pair (17711, 28657)

Sequential programs · Problem 0023

At Fibonacci iteration 22, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 22 begins with the pair of registers a=17711, b=28657.
  2. The current output is register a, so the emitted term is 17711.
  3. Calculate a temporary sum t = a+b = 17711+28657 = 46368.
  4. Copy the previous value of b into the new a register.
  5. The new a is 28657.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 46368.
  8. After the update, the pair is (28657, 46368).
  9. On the next iteration, the machine will emit 28657.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 17711; pair (28657, 46368)

Sequential programs · Problem 0024

At Fibonacci iteration 23, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 23 begins with the pair of registers a=28657, b=46368.
  2. The current output is register a, so the emitted term is 28657.
  3. Calculate a temporary sum t = a+b = 28657+46368 = 75025.
  4. Copy the previous value of b into the new a register.
  5. The new a is 46368.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 75025.
  8. After the update, the pair is (46368, 75025).
  9. On the next iteration, the machine will emit 46368.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 28657; pair (46368, 75025)

Sequential programs · Problem 0025

At Fibonacci iteration 24, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 24 begins with the pair of registers a=46368, b=75025.
  2. The current output is register a, so the emitted term is 46368.
  3. Calculate a temporary sum t = a+b = 46368+75025 = 121393.
  4. Copy the previous value of b into the new a register.
  5. The new a is 75025.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 121393.
  8. After the update, the pair is (75025, 121393).
  9. On the next iteration, the machine will emit 75025.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 46368; pair (75025, 121393)

Sequential programs · Problem 0026

At Fibonacci iteration 25, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 25 begins with the pair of registers a=75025, b=121393.
  2. The current output is register a, so the emitted term is 75025.
  3. Calculate a temporary sum t = a+b = 75025+121393 = 196418.
  4. Copy the previous value of b into the new a register.
  5. The new a is 121393.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 196418.
  8. After the update, the pair is (121393, 196418).
  9. On the next iteration, the machine will emit 121393.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 75025; pair (121393, 196418)

Sequential programs · Problem 0027

At Fibonacci iteration 26, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 26 begins with the pair of registers a=121393, b=196418.
  2. The current output is register a, so the emitted term is 121393.
  3. Calculate a temporary sum t = a+b = 121393+196418 = 317811.
  4. Copy the previous value of b into the new a register.
  5. The new a is 196418.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 317811.
  8. After the update, the pair is (196418, 317811).
  9. On the next iteration, the machine will emit 196418.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 121393; pair (196418, 317811)

Sequential programs · Problem 0028

At Fibonacci iteration 27, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 27 begins with the pair of registers a=196418, b=317811.
  2. The current output is register a, so the emitted term is 196418.
  3. Calculate a temporary sum t = a+b = 196418+317811 = 514229.
  4. Copy the previous value of b into the new a register.
  5. The new a is 317811.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 514229.
  8. After the update, the pair is (317811, 514229).
  9. On the next iteration, the machine will emit 317811.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 196418; pair (317811, 514229)

Sequential programs · Problem 0029

At Fibonacci iteration 28, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 28 begins with the pair of registers a=317811, b=514229.
  2. The current output is register a, so the emitted term is 317811.
  3. Calculate a temporary sum t = a+b = 317811+514229 = 832040.
  4. Copy the previous value of b into the new a register.
  5. The new a is 514229.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 832040.
  8. After the update, the pair is (514229, 832040).
  9. On the next iteration, the machine will emit 514229.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 317811; pair (514229, 832040)

Sequential programs · Problem 0030

At Fibonacci iteration 29, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 29 begins with the pair of registers a=514229, b=832040.
  2. The current output is register a, so the emitted term is 514229.
  3. Calculate a temporary sum t = a+b = 514229+832040 = 1346269.
  4. Copy the previous value of b into the new a register.
  5. The new a is 832040.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 1346269.
  8. After the update, the pair is (832040, 1346269).
  9. On the next iteration, the machine will emit 832040.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 514229; pair (832040, 1346269)

Sequential programs · Problem 0031

At Fibonacci iteration 30, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 30 begins with the pair of registers a=832040, b=1346269.
  2. The current output is register a, so the emitted term is 832040.
  3. Calculate a temporary sum t = a+b = 832040+1346269 = 2178309.
  4. Copy the previous value of b into the new a register.
  5. The new a is 1346269.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 2178309.
  8. After the update, the pair is (1346269, 2178309).
  9. On the next iteration, the machine will emit 1346269.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 832040; pair (1346269, 2178309)

Sequential programs · Problem 0032

At Fibonacci iteration 31, what is the output and next pair of register values?

Try it on paper first. The worked answer is hidden below.

Reveal detailed solution →
  1. Iteration number 31 begins with the pair of registers a=1346269, b=2178309.
  2. The current output is register a, so the emitted term is 1346269.
  3. Calculate a temporary sum t = a+b = 1346269+2178309 = 3524578.
  4. Copy the previous value of b into the new a register.
  5. The new a is 2178309.
  6. Copy the computed temporary t into the new b register.
  7. The new b is 3524578.
  8. After the update, the pair is (2178309, 3524578).
  9. On the next iteration, the machine will emit 2178309.
  10. The ordering matters: updating a too early without a temporary could destroy a needed operand.
  11. This trace uses unlimited mathematical integers; an eight-bit real register would wrap far earlier.

Final answer: output 1346269; pair (2178309, 3524578)