Workbench / Mathematics Book 1 Exercises: Arithmetic and Numbers
B1·01
What Numbers Are
Exercises for chapter 1: pairing and counting, the jobs numbers do, choosing the operation, the rules and the conventions, division by zero, and where a computer's numbers stop, with programs you run and senior exercises on identifiers, formula engines and empty averages.
Start here: how these exercises work
Each exercise has a box for your answer. Write first: the first hint opens once you've written a few lines of your own, each later hint after you've added to your answer, and the solution a couple of minutes after the last hint. Your writing stays in this browser.
- Theory asks you to explain, in your own words, with an everyday example. If you can't explain it to a friend, you don't have it yet.
- Practice and programs are calculations and short programs. Run every program yourself; the output shown is what it printed on the lab machine (Python 3.13, Node.js 22).
- Cumulative projects combine this chapter with every chapter before it. This is chapter 1, so it's this chapter alone.
- What the chapter leaves out explains ideas the chapter skips that matter later or at work.
- Senior exercises use the chapter the way an experienced engineer would: in designs, reviews and production decisions.
Theory
T1. Enough chairs, without counting
A wedding hall has stacks of chairs and a long queue of guests. Nobody wants to count either. Describe a procedure that tells you for certain whether there are enough chairs, exactly enough, or too few, without using any number words. Then explain why counting is really the same procedure.
T2. Three jobs on one bill
An electricity bill shows: consumer number 112045003317, bill for month 10, 2026, meter reading 48217, units consumed 186, due date 15, rank of your usage in your area (3rd lowest), and amount ₹1,254. Classify each number as cardinal, ordinal or nominal, and say which ones it makes sense to add, compare or average.
T3. One number, many numerals
Write the number of years from 1 CE to 2026 CE as a Roman numeral, in Devanagari digits, in binary and as a description of a tally. What is the same in all of them, and what is different?
T4. Which story?
For each situation, say which operation it needs and which story (combining, taking away, comparing, missing part, repeated addition, scaling, sharing, grouping). Don't calculate.
- A train has 18 coaches; 6 are AC. How many aren't?
- A ₹1,500 gift is split equally among 4 cousins.
- Your phone has 64 GB; 49 GB is used. How much is free?
- Rope comes in 15 m rolls; you need 120 m.
- Bus A carries 52 people, bus B 38. How many more are on A?
- A photo is enlarged to three times its width.
T5. Facts and conventions in a shopping bill
A bill has 3 packets of biscuits at ₹25 and 3 packets of tea at ₹140. Use the bill to explain distributivity. Then explain why "3 × 25 + 3 × 140" is computed as and not . Which part is a fact about the world and which is a convention?
T6. Three tools, one division by zero
A spreadsheet shows #DIV/0! for =A1/0, Python raises ZeroDivisionError for 1/0, and JavaScript prints Infinity for 1/0 and NaN for 0/0. Explain why mathematics leaves division by zero undefined, and why each tool's choice is reasonable for what it's used for.
Practice and programs
P1. The rules, used on purpose
Calculate mentally, naming the rule you use: (a) ; (b) ; (c) ; (d) ; (e) ; (f) .
P2. Test the rules by brute force
Write a program that checks commutativity and associativity of , , and for every choice of numbers from 1 to 20, and counts the failures. Predict the counts for subtraction before you run it.
P3. A Roman numeral reader, and what it doesn't check
Write to_roman(n) and from_roman(s), check that every number from 1 to 3,999 survives the round trip, then try from_roman("IIII") and from_roman("IC"). What do the results tell you about the difference between reading a numeral and checking that it's well formed?
P4. Where a computer's whole numbers stop
Find, by a loop rather than by looking it up, the first power of two at which adding 1 makes no difference, in Python floats and in JavaScript numbers. Compare with Python integers and with Number.MAX_SAFE_INTEGER.
Cumulative projects (chapters so far: 01)
C1. Split a bill fairly, in whole rupees
Write split_bill(items, people) where items is a list of (price, quantity) pairs. It returns the total and each person's share in whole rupees, with any remainder spread one rupee at a time, so the shares always add up to the total exactly. It must refuse zero people. Test it with items (180, 2), (240, 1), (35, 4) among 3 people.
What the chapter leaves out
Building the natural numbers from nothing
The chapter starts from collections. Mathematicians also build the natural numbers from a few rules, Giuseppe Peano's axioms (1889): 0 is a natural number; every natural number has a successor; 0 isn't a successor; different numbers have different successors; and induction: if a property holds for 0 and passes from each number to its successor, it holds for all. Addition and multiplication are then defined by what they do to successors (), and every rule in the chapter can be proved from those definitions. The point for a reader: "obvious" facts like are theorems, and induction is the tool that proves things about infinitely many numbers in finitely many steps. Chapter 3's bound on carries is induction in miniature.
Infinite collections
Pairing defines "same size" for infinite collections too, with startling results. The even numbers pair off with all the natural numbers (), so there are "as many" evens as naturals, though the evens are a part of them. Georg Cantor showed in 1891 that some infinite collections are strictly bigger than others: there are more real numbers than natural numbers (chapter 12 meets the reals). The chapter's "counting is pairing" is exactly the idea that makes this possible.
Implicit multiplication and the viral expressions
"" circulates online because conventions disagree. Many textbooks and calculators give multiplication written by juxtaposition, , higher priority than , giving 1; strict left-to-right gives 9. Physics journals commonly write to mean . There is no single right answer, only a convention that the writer failed to make clear. In code the question doesn't arise, because 6 / 2 * (1 + 2) must write the *, and every language then goes left to right.
Number words aren't tidy
Spoken numbers follow place value only roughly. English has "eleven" and "twelve" instead of "one-teen" and "two-teen"; Hindi has a separate word for every number up to 100 (उनतालीस for 39); French says "quatre-vingt-dix" (four twenties and ten) for 90. Research in cognitive science finds that children whose languages name numbers regularly (as Chinese does: "ten-one" for 11) tend to learn place value somewhat earlier. Numerals are more regular than the words we say them with.
Senior exercises
S1. Pincodes, phone numbers and IDs stored as numbers
You're reviewing a customer database where pincode, phone number and a 12-digit national ID are integer columns, and a JavaScript front end reads them from JSON. List the failures this design will cause, with an example of each, and propose the fix and a safe migration.
S2. Precedence for a pricing-rules engine
Your team is building a small expression language for pricing rules that product managers will write (base * 1.18 - discount, -x^2, 2^3^2). Decide the precedence and associativity of unary minus, ^, *, /, +, -, justify each choice, and say what you'd do about ambiguous input.
S3. The average of nothing
A sales dashboard shows "average order value" per shop per day: total revenue ÷ number of orders. Some shops have zero orders on some days. Lay out the options for what to show and store, the consequences of each for charts, totals and alerts, and choose.