Generate Integer Pairs — Cartesian, Range, Free
Generate all (i, j) integer pairs in a range. Cartesian product, ordered, distinct. Browser-only.
About Generate Integer Pairs
Generating integer pairs produces tuples (i, j) where i and j range over integers — useful for grid coordinates, test-case enumeration, combinatorial problems, and data-fixture generation. The ZTools Integer Pairs tool builds the Cartesian product i × j over user-defined ranges, with optional filters (i < j, i + j = constant, distinct, etc.). Output as JSON array of pairs, CSV, or human-readable list. Lazy evaluation handles large ranges without blowing browser memory.
Use cases
- Generate grid coordinates. 5×5 grid: pairs (0,0), (0,1), ..., (4,4) — 25 cells. Useful for board games, simulation seeds, image processing.
- Test-case enumeration. Test a function f(a, b) for all pairs in [−5, 5] × [−5, 5]. 121 cases. Generator outputs them — feed directly to your test runner.
- Combinatorial problems. "All pairs (i, j) with i + j = 10 and i, j ∈ [1, 10]". Constraint filtering finds them.
- Generate test data for ML. Synthetic feature pairs for regression / classification testing. Predictable ranges, no random surprises.
How it works
- Set ranges. Range for i (start, end, step). Range for j (separate start, end, step). Or one range used for both.
- Apply filter. i < j (no duplicates), i + j = constant, GCD(i, j) = 1 (coprime), or custom expression.
- Pick output format. JSON array of [i, j] pairs, CSV (i,j per row), or "i j" pairs separated by newlines.
- Generate + copy. For very large outputs (>10k pairs), download as file rather than copy.
Examples
Input: i ∈ [0, 2], j ∈ [0, 2]
Output: 9 pairs: (0,0), (0,1), (0,2), (1,0), ..., (2,2).
Input: i, j ∈ [1, 10] with i < j
Output: 45 pairs (10 choose 2): (1,2), (1,3), ..., (9,10).
Input: i, j ∈ [1, 10] with i + j = 10
Output: Pairs where sum is 10: (0, 10), (1, 9), (2, 8), ..., (10, 0). Filter to "i ≤ j" if you want unique combinations.
Frequently asked questions
Maximum number of pairs?
Browser limit is ~10 million in memory. For more, use a streaming download mode (lazy generation, write directly to file).
Can I include negative integers?
Yes — set range start to a negative number.
Custom step?
Yes — non-1 steps are supported (e.g. only even integers).
Output ordering?
Lexicographic by default — (0,0), (0,1), (0,2), (1,0), ... Can switch to "i first then j" or column-major if needed.
Privacy?
All in browser.
Pro tips
- For symmetric problems (where (i,j) = (j,i) doesn't add info), use the i < j filter — halves the output count.
- For very large ranges, prefer downloading the file — copying 10 million pairs to clipboard freezes the browser.
- For combinatorial constraints, use the custom expression filter — supports arbitrary boolean conditions on (i, j).
- For test cases, also generate edge values (0, max, min, off-by-one) explicitly — uniform grids miss boundary bugs.
Reviewed by Ahsan Mahmood · Last updated 2026-05-06 · Part of ZTools.
For the full,
formatted version of this page, please enable JavaScript and reload
https://ztools.zaions.com/integer-pairs.