T TestsWorld
Lesson 8 of 8 What an algorithm is ⏱ 5 min

Where the word comes from, and more algorithms

🤔
Think first
Why do computer scientists still use a word that comes from a 9th-century scholar's name?
🎯 In this lesson you'll learn
  • ✓Know where 'algorithm' comes from
  • ✓Build new algorithms from old ones

Around 820 CE the Persian scholar Al-Khwārizmī (780–850 CE), at Baghdad's House of Wisdom, wrote a book explaining the Indian place-value numerals and the Indian methods for the four operations. Its 12th-century Latin translation, Liber Algorismi de numero Indorum, spread Indian arithmetic in Europe. From Algoritmi, the Latin form of his name, came algorismus, then algorithm: first meaning an Indian method of calculation, now any well-defined step-by-step procedure.

Building new algorithms from old ones:

  • prime(n): n is prime exactly when divisors(n) has two entries, 1 and n.
  • primedivisors(n): compute divisors(n), keep only those that are prime. For 18: [2, 3].
  • Prime factorisation: 180 = 2² × 3² × 5¹ can be stored as pairs (2, 2), (3, 2), (5, 1).

Speed-up: divisors come in pairs, e.g. 18 = 1 × 18 = 2 × 9 = 3 × 6. Checking j up to √n finds every pair.

Every algorithm has: basic steps, repeated steps (for each j …), conditional steps (only if j divides n), a reason it is correct, and a count of how many steps it takes.

1×182×93×6test j only up to√18 ≈ 4.24each small divisor gives its partner 18 ÷ j for free

Tap the diagram to enlarge it

Every divisor below √18 has a partner above it.
✨
Did you know?
Al-Khwārizmī's book on Indian numerals survives only in a 12th-century Latin translation.
📌 Remember these
  1. Algorithm ← Al-Khwārizmī
  2. prime(n): exactly two divisors
  3. Pairs: test up to √n
✅ Quick check
← 🏁