An empty jar gets 3 cents on day 1, 6 cents on day 2, 9 cents on day 3, and so on, 3 more each day. How many cents are in it after day 6, and how can that be written in one short line?
1a worked example
Day 1 adds cents and day 2 adds , so day adds . A loop does one step again and again. A counter, here , counts the times: 1, 2, 3. Each time round is a pass.
In one line it is . The sign is sigma, the Greek letter that matches our S, and it means add up.
The table runs it, one row a pass. The total starts at 0. Under , is where the counter starts. On top, 6 is its last value.
Each pass adds the term beside ,. That is 3 on pass 1, then 6, then 9.
Written out, cents, the table's last total.
In general, with any number on top, is , with the dots standing for the terms between. For the jar, , so ,, and .
total before
counter
term
total after
0
1
3
3
3
2
6
9
9
3
9
18
18
4
12
30
30
5
15
45
45
6
18
63
One row per pass. Each total after becomes the next row's total before, ending at 63.
2how it works
Every term of the jar holds a 3, as . Take the 3 out, as in lesson 2.3, to get .
counter
term
written as
1
3
2
6
3
9
4
12
5
15
6
18
total
63
Every term is 3 times the counter, so the total is 3 times the counters' total, 21.
, so the jar holds cents, as the loop found.
In symbols, . A number in every term comes out in front of the sum.
3in symbols
A term of two parts splits into two sums: . In the table, that is .
The second sum's term has no in it, so the 4 is added on each of the 3 passes: .
With on top there are passes, so for any number ,. Seven passes adding 2 make .
counter
first part
second part 4
term
1
1
4
5
2
2
4
6
3
3
4
7
total
6
12
18
Each column adds up on its own. The two part totals, 6 and 12, make the term total, 18.
4your turn
Work each one out. Where there is a box, type your answer and check it. Each exercise's worked answer opens under it.
1exercise 1
A loop runs its counter from 1 to 8, and each pass adds 3 to a total that starts at 0.
Each column of 3 squares is one pass.
worked answer
The loop is , a term with no in it.
Eight passes each add 3, so the total is .
Check it another way: The picture has 3 rows of 8 squares, 24 in all.
2exercise 2
In some code, a loop is given a stop number and stops just before it. This loop's counter starts at 1 with stop number 9, so 9 itself is left out. Each pass adds to a total that starts at 0.
worked answer
The counter takes 1 to 8, so the loop works out .
Take out the 4. .
, so the total is .
Check it another way: The running totals go 4, 12, 24, 40, 60, 84, 112, 144.
3exercise 3
Write out .
worked answer
The counter takes 1, 2, 3, 4 and 5, so there are 5 terms.
Written out, .
Check it another way: Split it, the minus staying between the sums, . That is .