MathDoku

A Latin-square logic puzzle with arithmetic cages. Fill every row and column with 1..N, then make each cage hit its target with +, −, × or ÷.

How to play MathDoku (Calcudoku)

MathDoku, also known as Calcudoku, is a number logic puzzle that blends the row-and-column discipline of Sudoku with quick mental arithmetic. You are given a square grid — 4×4, 6×6 or 7×7 here — carved into outlined groups of cells called “cages”. Each cage shows a small target number and an operator in its top-left corner, such as “12×” or “3−”. Your job is to fill the whole grid with numbers so that every row and every column follows the Latin-square rule, while the numbers inside each cage combine to make its target. There is exactly one correct solution to every puzzle, and it can always be reached by pure logic — no guessing required.

The goal

Fill in every empty cell so that two things are true at once. First, each row and each column contains the numbers 1 up to N (4, 6 or 7 depending on the grid) exactly once, with no repeats. Second, the numbers inside every cage combine, using the cage’s operator, to produce the number printed in its corner. When the whole grid satisfies both conditions, the puzzle is solved.

The Latin-square rule

The backbone of MathDoku is the Latin square. On an N×N grid, every row must contain each of the numbers 1 to N once and only once, and every column must do the same. So a 4×4 grid uses the digits 1, 2, 3 and 4; a 6×6 grid uses 1 through 6; and a 7×7 grid uses 1 through 7. This is the same no-repeats idea that governs Sudoku rows and columns — but MathDoku has no 3×3 boxes. The Latin-square rule alone narrows the possibilities enormously, and combined with the cages it always leaves a single valid answer.

Cages

The bold outlines divide the grid into cages — small groups of between one and four connected cells. Every cell belongs to exactly one cage. The clue printed in a cage’s top-left cell tells you the target and the operation: the numbers you place in that cage must combine with the given operator to equal the target. A cage can be any connected shape — an L, a line, a square block — as long as the cells touch edge to edge. Bigger grids tend to use bigger cages, which is part of what makes the harder sizes harder.

The four operators

  • Addition (+): the numbers in the cage add up to the target. A cage marked “9+” covering three cells might be filled with 2, 3 and 4, because 2 + 3 + 4 = 9. Addition cages can be any size.
  • Subtraction (−): used only on two-cell cages. Subtract the smaller number from the larger so the difference equals the target. A “3−” cage could hold 5 and 2, because 5 − 2 = 3, or 1 and 4, because 4 − 1 = 3.
  • Multiplication (×): the numbers in the cage multiply together to the target. A “12×” cage of two cells might be 3 and 4 (3 × 4 = 12); a three-cell “24×” cage could be 2, 3 and 4. Multiplication cages can be any size.
  • Division (÷): used only on two-cell cages. Divide the larger number by the smaller so the quotient equals the target. A “2÷” cage could be 6 and 3, because 6 ÷ 3 = 2, or 4 and 2, because 4 ÷ 2 = 2. Division cages only appear when the pair divides evenly.
  • Single cells: a cage of just one cell shows only a number with no operator (for example “3”). That number is simply the answer for that cell — a free given to get you started.

Why order does not matter for − and ÷

Subtraction and division normally depend on which number comes first, but in MathDoku the two-cell − and ÷ cages are order-independent. For subtraction you always take the absolute difference — the larger minus the smaller — so 5 and 2 give 3 whether you read them as 5 − 2 or 2 − 5. For division you always divide the larger by the smaller, so 6 and 3 give 2 either way. This means you never have to worry about which cell “comes first”; you only need to find a pair of numbers with the right difference or ratio. Addition and multiplication are naturally order-independent too, since a + b = b + a and a × b = b × a.

How to play on this screen

  • Tap a cell to select it, then tap a number on the pad (1 to N) to place it. Tap the same cell and a different number to change it, or use the erase (⌫) key to clear it.
  • Turn on pencil-note mode with the ✏️ button when you are unsure. In note mode the numbers you tap are recorded as small candidates in the corner of the cell instead of a final answer, so you can track the possibilities before committing.
  • Cages give live feedback: when every cell in a cage is filled, the cage tints green if its arithmetic matches the target and red if it does not. A number that repeats in its row or column is shown in red so you can spot the clash.
  • On a keyboard you can move the selection with the arrow keys, type a digit to fill the selected cell, press Backspace to erase, and press N to toggle pencil notes. Use New Puzzle at any time for a fresh grid, or the Size menu to change difficulty.

Winning

You win the moment the grid is completely filled, every row and column holds 1 to N with no repeats, and every cage satisfies its target. Because each puzzle is generated with a guaranteed unique solution, a fully valid grid can only be the intended one — there is never a second correct answer. The timer stops, your score is calculated, and if you are signed in the result is submitted to the leaderboard for that difficulty.

Strategy tips

  • Start with the single-cell cages and the most constrained cages. A one-cell “given” fixes a value instantly, and small cages with only one possible combination (like a “1−” pair that must be consecutive numbers) give you firm footholds to build from.
  • List the combinations a cage allows before placing anything. A two-cell “12×” on a 6×6 grid can only be 2×6 or 3×4, for instance. Writing those candidates as pencil notes turns a big search into a small one.
  • Cross-check cages against the Latin-square rule. A combination that is arithmetically valid may still be impossible because one of its numbers already appears elsewhere in that row or column. Eliminating those cases is where most progress comes from.
  • Use the totals of a row or column. Every line adds up to the same fixed sum (1 + 2 + … + N). Comparing that known total against the cages that lie in the line can reveal a missing value without any guessing.
  • Never guess — MathDoku always yields to logic. If you feel stuck, switch to pencil notes and mark every candidate; the contradictions you uncover will steadily narrow each cell to a single number.

Frequently asked questions

How is my score calculated?

Your score is max(1, 9000 − seconds − mistakes × 250), capped at 99999. You start from a base of 9000; every second that passes subtracts one point, and every wrong digit you enter subtracts 250. Solve quickly and cleanly for a higher score. Scores are tracked separately for each grid size, and higher is better.

Is there always exactly one solution?

Yes. Each puzzle is built from a random Latin square, split into cages, and then verified by a solver that counts how many ways the grid can be completed. Only layouts with exactly one solution are kept, so you never need to guess — every puzzle can be finished by logic alone.

What is the difference between the sizes?

Easy is a 4×4 grid using the numbers 1–4, Medium is 6×6 using 1–6, and Hard is 7×7 using 1–7. Larger grids have more cells, larger cages and more numbers to juggle, so they take longer and demand more careful deduction.

What are pencil notes for?

Pencil notes let you jot the candidate numbers a cell might take without committing to a final answer. Tap the ✏️ button (or press N) to switch into note mode, then tap numbers to add or remove them. They are a memory aid only and never count as mistakes.

Is this the same as other grid maths puzzles?

MathDoku belongs to the family of arithmetic Latin-square puzzles, sometimes published under names like Calcudoku or Mathdoku. This is our own original implementation with freshly generated puzzles; it is not affiliated with any trademarked brand.

Does it work offline?

Yes. Once the page has loaded, every puzzle is generated and solved entirely in your browser, so you can play with no internet connection. Scores earned offline are stored on your device and upload automatically the next time you are online and signed in.