Trace rules with decisions, compare algorithms and choose instructions for number patterns.
Example 1
Two algorithms start at 4. Algorithm A adds 2 on each step; algorithm B multiplies by 2 on each step. After 4 steps, how much larger is B's output than A's?
Show worked answer
Answer: 52
- Algorithm A:4+4×2=12.
- Algorithm B:4×2×2×2×2=64. The difference is 64−12=52.
Example 2
Which algorithm produces the sequence 1.5,2,2.5,3?
Show worked answer
Answer: Start at 1.5; add 0.5 each time.
- The first output is 1.5.
- Each difference is 0.5, so start there and repeatedly add 0.5.
Example 3
Two algorithms start at 6. Algorithm A adds 2 on each step; algorithm B multiplies by 2 on each step. After 2 steps, how much larger is B's output than A's?
Show worked answer
Answer: 14
- Algorithm A:6+2×2=10.
- Algorithm B:6×2×2=24. The difference is 24−10=14.