KenKen Table Generator
Generate printable KenKen puzzles with customizable grid sizes (3-9), difficulty levels, and cage operations. Export as PNG or print.
About
KenKen is a constraint-based arithmetic puzzle invented by Tetsuya Miyamoto in 2004. The grid must form a valid Latin Square: each row and column contains the digits 1 through n exactly once, where n is the grid dimension. Cells are grouped into cages, each marked with a target number and an arithmetic operation (+, โ, ร, รท). The digits within each cage must produce the target when combined using that operation. Incorrect cage arithmetic or a duplicate digit in any row or column constitutes an invalid solution. This generator constructs a guaranteed-unique-solution puzzle using backtracking Latin Square generation, randomized adjacency-based cage partitioning, and constraint-propagation verification.
Difficulty is controlled by cage size distribution and operation mix. Larger cages with multiplication increase combinatorial search space. Division and subtraction cages are restricted to two cells to ensure integer results. A 3ร3 grid has 12 valid Latin Squares; a 9ร9 grid has approximately 5.524ร1027. The tool approximates puzzle difficulty assuming standard human solving heuristics. Pro tip: for classroom use, 4ร4 Easy is appropriate for ages 7-9; 6ร6 Hard suits adult solvers.
Formulas
The puzzle enforces two constraint families simultaneously: the Latin Square constraint and the cage arithmetic constraint.
Latin Square Constraint:
For each row r: {ar,1, ar,2, โฆ, ar,n} = {1, 2, โฆ, n}
For each column c: {a1,c, a2,c, โฆ, an,c} = {1, 2, โฆ, n}
Cage Arithmetic Constraints:
Addition cage: โ ai = T for all cells i โ cage
Subtraction cage (2 cells): |a1 โ a2| = T
Multiplication cage: โ ai = T for all cells i โ cage
Division cage (2 cells): max(a1, a2)min(a1, a2) = T , T โ Z+
Where n = grid dimension, T = cage target value, ai = digit in cell i. The generator first constructs a valid Latin Square via constrained random fill with backtracking, then partitions into cages using randomized BFS from seed cells, assigns operations based on difficulty parameters, and verifies solution uniqueness via constraint-propagation solver.
Reference Data
| Grid Size | Valid Latin Squares | Typical Cage Count | Easy (Avg Cage Size) | Hard (Avg Cage Size) | Est. Solve Time (Easy) | Est. Solve Time (Hard) |
|---|---|---|---|---|---|---|
| 3ร3 | 12 | 4-5 | 1.5 | 2.0 | 1-2 min | 2-4 min |
| 4ร4 | 576 | 5-8 | 1.8 | 2.5 | 3-5 min | 5-10 min |
| 5ร5 | 161,280 | 8-12 | 2.0 | 3.0 | 5-10 min | 10-20 min |
| 6ร6 | 812,851,200 | 10-16 | 2.2 | 3.2 | 8-15 min | 15-30 min |
| 7ร7 | ≈6.1ร1013 | 14-20 | 2.3 | 3.5 | 12-20 min | 25-45 min |
| 8ร8 | ≈1.08ร1020 | 18-26 | 2.4 | 3.5 | 15-30 min | 30-60 min |
| 9ร9 | ≈5.52ร1027 | 22-32 | 2.5 | 3.8 | 20-40 min | 45-90 min |
| Operations Reference | ||||||
| + Addition | Sum of all digits in cage = target. Valid for cages of 2 - 5 cells. | |||||
| โ Subtraction | Absolute difference of two digits = target. Restricted to 2-cell cages only. | |||||
| ร Multiplication | Product of all digits in cage = target. Valid for cages of 2 - 4 cells. | |||||
| รท Division | Ratio of larger to smaller digit = target (integer only). Restricted to 2-cell cages. | |||||
| No operation | Single-cell cage. Target = the cell value (given digit). | |||||