Mathematics

Team coding toolkit

Professor PiAlgebra12 cardsFree · no account needed

Answer in your head, then tap to check. Slide or use the buttons to grade.

MathematicsTeam coding toolkit
1 / 12
Mathematics · Team coding toolkitProfessor Pi
↔ Asked both waysAnswer in your head…A method that solves a problem by calling itself on a smaller version of it
Tap to check

KS3-MATH-PCT-0001Front

Mathematics · Team coding toolkitProfessor Pi

Recursion

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

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0001Back

Mathematics · Team coding toolkitProfessor Pi
Answer in your head…A program shares out whole sweets between children and must never split one. Which kind of division does it need?
Tap to check

KS3-MATH-PCT-0002Front

Mathematics · Team coding toolkitProfessor Pi

Whole-number division

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

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0002Back

Mathematics · Team coding toolkitProfessor Pi
Answer in your head…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?
Tap to check

KS3-MATH-PCT-0003Front

Mathematics · Team coding toolkitProfessor Pi

The nth term rule

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

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0003Back

Mathematics · Team coding toolkitProfessor Pi
⌨ Type the answerAnswer in your head…The running totals 1, 3, 6, 10, 15 … which stack into a neat pyramid of dots, are called the … numbers? (one word)

KS3-MATH-PCT-0004Front

Mathematics · Team coding toolkitProfessor Pi

triangular

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

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0004Back

Mathematics · Team coding toolkitProfessor Pi
Answer in your head…To decide whether a number is prime, a program tries dividing by 2, 3, 4 and upwards. At which value can it safely stop?
Tap to check

KS3-MATH-PCT-0005Front

Mathematics · Team coding toolkitProfessor Pi

Its square root

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

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0005Back

Mathematics · Team coding toolkitProfessor Pi
Answer in your head…Two lights flash on regular but different cycles and have just flashed together. Which number tells a program when they next coincide?
Tap to check

KS3-MATH-PCT-0006Front

Mathematics · Team coding toolkitProfessor Pi

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.

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0006Back

Mathematics · Team coding toolkitProfessor Pi
↔ Asked both waysAnswer in your head…The longest side of a right-angled triangle, always opposite the right angle
Tap to check

KS3-MATH-PCT-0007Front

Mathematics · Team coding toolkitProfessor Pi

The hypotenuse

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

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0007Back

Mathematics · Team coding toolkitProfessor Pi
Fill the gapAnswer in your head…A computer stores decimals only approximately, so a program should test two of them by checking they are ____ rather than exactly equal.
Tap to check

KS3-MATH-PCT-0008Front

Mathematics · Team coding toolkitProfessor Pi

close

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

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0008Back

Mathematics · Team coding toolkitProfessor Pi
Fill the gapAnswer in your head…Nearly every programming language works out × and ÷ before + and −, following the same priority order you learned as ____.
Tap to check

KS3-MATH-PCT-0009Front

Mathematics · Team coding toolkitProfessor Pi

BIDMAS

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

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0009Back

Mathematics · Team coding toolkitProfessor Pi
Fill the gapsAnswer in your head…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 ____.
Tap to check

KS3-MATH-PCT-0010Front

Mathematics · Team coding toolkitProfessor Pi

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.

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0010Back

Mathematics · Team coding toolkitProfessor Pi
Answer in your head…In Round 1 of the Perse Coding Team Challenge, how do entrants normally work?
Tap to check

KS3-MATH-PCT-0011Front

Mathematics · Team coding toolkitProfessor Pi

In pairs on one computer

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

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0011Back

Mathematics · Team coding toolkitProfessor Pi
⌨ Type the answerAnswer in your head…Round 1 of the Perse Coding Team Challenge lasts how many minutes? (type the number only)

KS3-MATH-PCT-0012Front

Mathematics · Team coding toolkitProfessor Pi

40

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

The 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.

same next review — Easy spaces out faster after that

KS3-MATH-PCT-0012Back

Team coding toolkit

12 cards

0Got it
0Tricky
12Skipped
Adopt into my skyNo account yet? See plans

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.