MyLeoNes™

Computational thinking: split, spot patterns, write an… — 11–13

Keep the essential, break a problem into easier steps, reuse patterns, write a step-by-step algorithm and debug it — on real numbers.

Five tools for hard problems

Abstract: keep only the essential information (names and cities do not count). Decompose: split into simple steps, 23 × 14 = 23 × 10 + 23 × 4 = 230 + 92 = 322. Spot patterns: 1 + 3 = 4, 1 + 3 + 5 = 9, 1 + 3 + 5 + 7 = 16 (2 × 2, 3 × 3, 4 × 4), and use it to predict. Algorithm: a step-by-step procedure that works for any value. Debug: test it, find the wrong step and fix it.

Why: a big problem becomes several small ones

You cannot easily do 23 × 14 in one go in your head, but 23 × 10 and 23 × 4 you can. Decomposing lowers the difficulty. An algorithm adds something else: anyone, or a computer (for instance in Scratch), can follow it without thinking and always gets the same result. And when something goes wrong you know which step to check. That is computational thinking, and it works without any computer.

A case: is 91 a prime number?

Abstract: only one thing matters, whether some number other than 1 and 91 divides 91. Algorithm: for d = 2, 3, 4, … up to 90, find the remainder of 91 ÷ d; if it is 0, stop: not prime. Version 1 takes a shortcut and tests only 2, 3 and 5: remainders 1, 1, 1, so it says "prime". Debug with a known case: 49 = 7 × 7 gives remainders 1, 1, 4, and it also says "prime", so the shortcut is wrong. The 7 was missing: 91 ÷ 7 = 13 remainder 0, so 91 = 7 × 13 is not prime.

Trusting the first result

Ana decomposed 23 × 14 = 23 × 10 + 4 = 234. It looks fine, since 14 = 10 + 4, but the 4 also has to multiply 23: 23 × 4 = 92, and 230 + 92 = 322. How could she find out? With an estimate: 20 × 15 = 300, far from 234. Debugging means testing the result (an estimate, a known case) and hunting for the step that failed, not starting again from scratch or changing numbers at random.

Where you see it: recipes, maps, games

A recipe is an algorithm: the same steps give the same cake. A map app breaks a journey into stretches. In Scratch you break a game into small blocks (move, count points, end the game), and if the character walks through a wall you debug that block only. Even sorting five cards uses it: you look for a pattern, repeat a rule and check the result. The maths you learned about primes, multiples and multiplication is the material these tools work on.

Keep exploring

Other languages

Loading MyLeoNes™…