An empty stack is given 4, 9, -, 7, 2, -. Each number is put on, and each dash takes the top off. What does the pile hold then, bottom first?
the answer, and why
the answer is B
9 goes on 4 and comes straight back off. Then 7 and 2 go on, and the last take takes 2, the top.
Stack, newest out. Puts and takes happen at the right end, the top. The heavy line is the bottom.
Out, in turn: 9, 2.
just put in
just taken out
Each operation in turn. The pile ends holding 4 and 7.
if you chose another
AThat keeps 9, but the first take takes 9, the top then.
CThat takes 4, the bottom. A take only ever takes the top.
DThat misses the first take, which takes 9 off.
2question 2
How many numbers come back from an empty stack given 8, 3, -, -, -, 5, -?
the answer, and why
the answer is C
The first two takes give back 3, then 8. The third finds the pile empty and gives nothing. The last gives back 5.
Stack, newest out. Puts and takes happen at the right end, the top. The heavy line is the bottom.
Out, in turn: 3, 8, 5.
just put in
just taken out
The third take finds nothing, so 3 numbers come back.
if you chose another
AThat counts every dash, but the third take finds the pile empty.
BThat stops before 5 goes on and comes back.
DThat counts every operation, the puts too.
3question 3
Which is true of putting numbers on an empty stack, then taking all off?
the answer, and why
the answer is A
Each put and each take touches only the end of the row and counts 1, whatever the numbers. Section 1 says so, and lines 1 and 2 of section 4's first question.
CThat reverses the order the numbers went on, as if all went on before any came off.
DThat gives 3 before 8, but 3 is under 8 when the last two takes come.
pen and paper
5question 5about 8 minutes
A program keeps a pile in a row with room for 1 number. A put that finds the row full first copies every number into a new row with twice the room. You put on 7 numbers, so is 7. Here is the smallest power of 2 at or above 7, which is 8.
At which puts does the row double?
How many numbers are copied in all?
Check your count against , the formula of section 4, and against .
a hint
The put after 1, 2 and 4 numbers finds the row full.
a worked answer
The row doubles at puts 2, 3 and 5, when it holds 1, 2 and 4 numbers. Those copies make 1 + 2 + 4, which is 7. With at 8, is 7 too. That is at most , which is 13.
held
just put in
copied into the new row, bracketed under it
room to spare
Seven puts into a row with room for 1, doubling at puts 2, 3 and 5.
A row with room for 1 doubles when a put finds it full. How many numbers do puts copy?11 of 11 shown
1the move: a full row doubles
the line:
held
just put in
copied into the new row, bracketed under it
room to spare
Nine puts. The row doubles at puts 2, 3, 5 and 9, copying 1, 2, 4 and 8 numbers.
why it is allowed: A put that finds the row full first copies every number into a new row with twice the room. Then it writes its own.
2the move: price a doubling
the line:
held
copied into the new row, bracketed under it
just put in
room to spare
Put 5 finds a row of 4 full. It copies each number to the same place in a row of 8, then writes 7.
why it is allowed: The room starts at 1 and only doubles, so it runs 1, 2, 4, 8. A full row holds as many numbers as its room, and the next put copies them all. Put 5 finds 4 and copies 4.
guess it, then
3the move: the last room
the line:
Doublings of 1 up to 16. 9 lies between 8 and 16, so is 16.
why it is allowed: For 9, put 9 found the row full at 8 and doubled it to 16. So 8 is below 9, and 16 is at or above 9. In general, by line 2 the rooms run 1, 2, 4, and on, so is a power of 2. It holds all , so it is at least . It doubled from half of only when a put found that half full, so half of is below . This holds from 2 numbers on; at 1, nothing doubles.
guess it, then
4the move: add the copies
the line:
why it is allowed: is the copies of puts. By lines 2 and 3, the doublings copy the rooms 1, 2, 4, and on, up to half of , the room before the last doubling. For 9, 1 + 2 + 4 + 8, and is 16.
guess it, then
5the move: add the doublings
the line:
where does this come from?
question 1 of the page doubling and halving sumsAdd . What is the total?
1the move: name the sum
the line:
why it is allowed: Let be the doubling sum up to . For as 3, it is 1 + 2 + 4 + 8.
2the move: double both sides
the line:
why it is allowed: Each term doubled is the next one along, and becomes . Doubling both sides keeps them equal. The plan: the two sums share all but their ends.
3the move: take line 1 away
the line:
why it is allowed: Take from both sides of line 2. On the right, write out as line 1 does.
4the move: tidy the left side
the line:
why it is allowed: Two lots of less one lot is one lot.
5the move: cancel what both brackets share
the line:
when n is 3
1
2
4
8
16
first bracket
2
4
8
16
second bracket
1
2
4
8
left over
take away 1
16
Line 4 when is 3. The 2, 4 and 8 cancel, leaving 16 less 1, which is 15.
why it is allowed: Every term from 2 to is in both brackets and cancels, leaving less 1.
6the move: the terms before the last
the line:
why it is allowed: The sum of line 5 stopping one term sooner: line 5 with for . For 3, it is 1 + 2 + 4. At as 0 no terms are left, adding to 0, and 2 to the power 0, less 1, is 0 too.
7the move: tidy the power
the line:
why it is allowed: One more than is . For 3, 1 + 2 + 4 is 7, one less than 8.
8the move: read it
the line:
why it is allowed: By lines 6 and 7, the terms before the last add to one less than it: the last outweighs them all. By line 5 the sum is under , twice the last.
why it is allowed: The box under this line shows a doubling sum from 1 is one less than the next doubling. In the box, is not the puts: it counts the doublings from 1 to the last term. For 9 puts it is 3, as 1 doubled 3 times is 8, half of . After half of comes . For 9, 15 is 16 less 1.
guess it, then
6the move: the room is under twice the numbers
the line:
why it is allowed: By line 3, half of is below . Doubling both, is below . For 9, 8 is below 9, so 16 is below 18.
guess it, then
7the move: a ceiling
the line:
why it is allowed: By lines 5 and 6, is less 1, and is below , so is at most . For 9, 15 is at most 17. That is under 2 copies a number; in Sebastian Bourges' books, 'Under two moves per item' (volume two, chapter 21; their moves are this page's copies).
guess it, then
8the move: add the puts' own writes
the line:
why it is allowed: Each put also writes its own number, writes in all. Add to both sides; and make . For 9, 15 + 9 is 24, at most 26.
guess it, then
9the move: read it as a bound
the line:
why it is allowed: By line 8, with the fixed multiple 3.
guess it, then
10the move: share it out
the line:
put
copies and its write
so far
share so far
1
1
1
1
2
2
3
1.5
3
3
6
2
4
1
7
1.75
5
5
12
2.4
6
1
13
about 2.17
7
1
14
2
8
1
15
about 1.88
9
9
24
about 2.67
Each put's copies and its own write, added up as the puts come. The share never reaches 3.
why it is allowed: Line 8 divided by shares the copies and writes over the puts. One put may copy many, as put 9 copies 8. For 9, 24 over 9.
guess it, then
11the move: under 3
the line:
why it is allowed: Line 10 takes one over from 3, and one over is above 0, so the share is under 3. For 9, 24 over 9 is about 2.67.
guess it, then
try it with a small : at , line 4 gives , which you can work out by hand
Another program keeps a pile in a row with its top at the start, place 1. A put first moves each number held one place along; a take moves each number still held one place back. Put on 6 numbers, then take all 6 off.
How many moves do the 6 puts make?
And the 6 takes?
How many puts, takes and moves in all, against the top kept at the end?
a hint
Here is how many numbers the pile holds when a put comes, or still holds after a take. The put onto numbers moves all , and so does the take that leaves .
a worked answer
The puts find 0, 1, 2, 3, 4 and 5 numbers, 15 moves. The takes leave 5, 4, 3, 2, 1 and 0, 15 more, so 30 in all, and at 6 is 30. With the 12 puts and takes that makes 42, which is at 6. Kept at the end, the pile costs 12 puts and takes and no moves.
operations
moves
puts and takes
6 puts
0 + 1 + 2 + 3 + 4 + 5, which is 15
6
6 takes
5 + 4 + 3 + 2 + 1 + 0, which is 15
6
in all
30
12
the top at the end
0
12
The top at the start, 6 numbers on and off, then the top at the end.
Keep the top at the row's start instead. How many moves do puts, then takes, make?15 of 15 shown
1the move: a put at the start
the line:
Stack, top at the start: place 1, on the left. A put moves each number held one place along; a take moves each one back.
Moves in all: 6.
just put in
just taken out
moved one place along
moved one place back
Three numbers on, then off, with the top at place 1, on the left. Kept at the end, the same pile needs no moves.
why it is allowed: The top is now place 1, so the new number needs place 1 free. Each of the numbers held moves one place along first.
2the move: a take at the start
the line:
why it is allowed: The top leaves place 1, and each of the numbers still held moves one place back to fill the gap.
guess it, then
3the move: add the moves
the line:
why it is allowed: is the moves of puts, then takes. By line 1 the puts move 0, 1, up to . By line 2 the takes move , down to 0, the same sum. For 3, 6.
guess it, then
4the move: leave out the 0
the line:
why it is allowed: Adding 0 changes nothing.
guess it, then
5the move: use the page on adding up
the line:
where does this come from?
question 1 of the page adding up Fit two staircases of squares together. What shape do they make?
1the move: draw the sum as a staircase
the line:
why it is allowed: Let be the sum of the whole numbers from 1 to . Draw it as a staircase, a column for each number: 1 square, then 2, and so on up to . For 5, columns of 1, 2, 3, 4 and 5 hold 15 squares.
2the move: take two staircases
the line:
why it is allowed: Two staircases hold twice the squares. Doubling both sides of line 1 keeps it true.
3the move: fit them into a rectangle
the line:
Blue stands, yellow hangs. Two staircases of 1 to 5 squares fill a rectangle 5 wide and 6 tall, 30 squares. So 1 + 2 + 3 + 4 + 5 is 5 times 6, halved, which is 15.
why it is allowed: Stand one staircase with its tallest column on the left. Hang the other upside down from the top, its tallest column on the right, as in the picture. The first column holds standing and 1 hanging. Each column to the right, the standing one loses a square and the hanging one gains one. So every column holds , and the columns fill a rectangle wide and tall.
4the move: halve both sides
the line:
why it is allowed: Halving both sides of line 3 keeps it true and leaves one . For 5, half of 30 is 15.
why it is allowed: The box under this line adds 1 up to a last number with two staircases, that number times one more, halved. Here the last number is . For 3, 2 times 3, halved, is 3, and times 2 is 6, as line 3.
guess it, then
6the move: halve, then double
the line:
why it is allowed: Halving, then doubling, changes nothing. For 3, 3 doubled is 6.
guess it, then
7the move: tidy
the line:
why it is allowed: is . For 3, 2 times 3 is 6.
guess it, then
8the move: multiply out
the line:
why it is allowed: lots of , less lots of 1. For 3, 9 less 3.
guess it, then
9the move: add the puts and takes
the line:
why it is allowed: Each put still writes its number and each take gives one back, puts and takes, as with the top at the end. Add to both sides; and make . For 3, 6 + 6 is 12.
guess it, then
10the move: a ceiling
the line:
why it is allowed: Line 8 takes away from . For 3, 6 is at most 9.
guess it, then
11the move: read it as a bound
the line:
why it is allowed: By line 10, with the fixed multiple 1.
guess it, then
12the move: a fact about n
the line:
why it is allowed: is times half of , and half of is at least 1 from 2 on. For 3, 3 is at most 4.5.
guess it, then
13the move: a floor
the line:
why it is allowed: Line 8 takes from . By line 12, is at most half of , so at least half is left. For 3, 9 less 3 is 6, at least 4.5.
guess it, then
14the move: read it as a bound
the line:
why it is allowed: By line 13, with the fixed multiple one half, from 2 numbers on.
guess it, then
15the move: ceiling and floor together
the line:
why it is allowed: Lines 11 and 14 bound by the same growth, .
guess it, then
try it with a small : at , line 3 gives , which you can work out by hand