Mathematics · Professor Pi

Every card in Team coding toolkit

The whole deck, in order — so you can read it through before your child ever sees it.

1 KS3-MATH-PCT-0001

A method that solves a problem by calling itself on a smaller version of it

Recursion

HintRussian dolls do it; so does a mirror facing another mirror.

WhyIt needs two parts: a base case small enough to answer outright, and a step that shrinks the problem towards that base case. Miss the base case and the program never stops. Term-to-term sequences in maths are the same idea — each term is defined from the one before, and the first term is the base case.

2 KS3-MATH-PCT-0002

A program shares out whole sweets between children and must never split one. Which kind of division does it need?

Whole-number division

HintThe kind that keeps what is left over as a separate answer, rather than trailing off into a decimal tail.

WhyMost languages offer two divide operators: one gives 3.5, the other gives 3 with a leftover of 1. Timed rounds lean on the second constantly — filling boxes, counting complete rows, wrapping a clock past 12. Reaching for the wrong one is a favourite way to lose an otherwise correct solution.

3 KS3-MATH-PCT-0003

A pattern grows by the same amount at every step. What lets a program jump straight to the 500th value without looping through the rest?

The nth term rule

HintThe position-to-value formula — the one written with n in it.

WhyA term-to-term rule ('add 4 each time') needs every step before the one you want; a position-to-value rule ('4n + 1') goes straight there. For a linear pattern the multiplier of n is the common difference, and the constant is whatever makes the first value come out right. In a timed round, replacing a loop of 500 steps with one line of arithmetic is often the whole trick.

4 KS3-MATH-PCT-0004

The running totals 1, 3, 6, 10, 15 … which stack into a neat pyramid of dots, are called the … numbers? (one word)

triangular

HintThink of the shape a rack of snooker reds makes, then use the adjective form of that shape.

WhyThey are the running totals 1, 1+2, 1+2+3 …, so the nth one is n(n+1)/2. That formula replaces a whole loop, which is why it turns up in timed rounds so often.

5 KS3-MATH-PCT-0005

To decide whether a number is prime, a program tries dividing by 2, 3, 4 and upwards. At which value can it safely stop?

Its square root

HintIf a divisor bigger than this existed, its partner would be smaller and you would have met it already.

WhyDivisors come in pairs that multiply to the number: for 36 they are 2 × 18, 3 × 12, 4 × 9, 6 × 6. Past 6 the pairs simply repeat the other way round, so nothing new can appear. Stopping there turns a check on a million from a million steps into a thousand — which is the difference between a solution that finishes inside the round and one that does not.

6 KS3-MATH-PCT-0006

Two lights flash on regular but different cycles and have just flashed together. Which number tells a program when they next coincide?

Their lowest common multiple

HintYou meet it as the partner of HCF; buses at a stop setting off again at the same moment is the classic question.

WhyFlashing lights, buses at a stop, gear teeth lining up — all the same question. For cycles of 4 and 6 the answer is 12, not 24: multiplying the two cycles always gives a time that works, but usually not the earliest one. Divide the product by the HCF to get it right, or in code walk through the multiples of the larger cycle until one fits the smaller.

7 KS3-MATH-PCT-0007

The longest side of a right-angled triangle, always opposite the right angle

The hypotenuse

HintGreek for 'stretching under'; it is the side a ladder makes when it leans against a wall.

WhyPythagoras gives its length: square the two shorter sides, add them, take the root. Programs use it constantly for the straight-line distance between two points on a grid, where the difference across and the difference up are the shorter sides. Comparing squared distances instead of rooted ones is a common speed trick, because the ordering comes out the same either way.

8 KS3-MATH-PCT-0008

A computer stores decimals only approximately, so a program should test two of them by checking they are ____ rather than exactly equal.

close

HintExact matching fails here — what you want is a tolerance, a tiny gap you are willing to accept.

WhyIn most languages 0.1 + 0.2 does not equal 0.3 exactly; it comes out a hair over, because binary cannot write 0.1 any more neatly than decimal can write a third. The fix is to check the difference is smaller than some tiny amount. Whole numbers have no such problem, which is one reason experienced coders stay with integers wherever they can.

9 KS3-MATH-PCT-0009

Nearly every programming language works out × and ÷ before + and −, following the same priority order you learned as ____.

BIDMAS

HintThe six-letter word your maths teacher writes on the board; brackets come first in it.

WhyBrackets, Indices, Division and Multiplication, then Addition and Subtraction. Languages agree with the maths, so 2 + 3 * 4 is 14 rather than 20. Where they can differ from each other is what a bare minus sign does in front of a power — when in doubt, add brackets: they cost nothing and settle the argument.

10 KS3-MATH-PCT-0010

A whole number that divides exactly into another is a ____ of it; a number appearing in another number's times table is a ____ of it; a number with exactly two divisors is ____.

factor; multiple; prime

HintAll three are Year 7 words about how one whole number sits inside another; the last is the special case with the fewest.

WhyThese three words carry most of the number theory a coding round needs. Note the two edge cases a test program will throw at you first: 1 is not prime, because it has only one divisor, and 2 is the only even prime there is.

11 KS3-MATH-PCT-0011

In Round 1 of the Perse Coding Team Challenge, how do entrants normally work?

In pairs on one computer

HintNot alone and not in a big group — and there is only a single keyboard between them.

WhyRound 1 runs for 40 minutes, with entrants working in twos — or solo where a school has to — on a single machine, and a high score carries them through to Round 2, which lasts an hour and allows teams of up to three. The challenge is run by The Perse School in Cambridge, is free to enter, and is open to UK pupils in Year 11 and below. Solutions may be written in Python, C++, C#, Java, JavaScript or Visual Basic.Net.

12 KS3-MATH-PCT-0012

Round 1 of the Perse Coding Team Challenge lasts how many minutes? (type the number only)

40

HintIt is shorter than Round 2, which runs for a full hour.

WhyRound 1 is forty minutes, Round 2 sixty. Judging roughly how long a problem will take before you start it is a real part of the skill — an unfinished perfect answer scores nothing at all.

Keep what you learn

Here, nothing is saved. In your child’s own sky every card is scheduled — it comes back just before they’d forget it — and the professor who wrote it is one tap away.