Skip to main content

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​

  1. Set ranges β€” Range for i (start, end, step). Range for j (separate start, end, step). Or one range used for both.
  2. Apply filter β€” i < j (no duplicates), i + j = constant, GCD(i, j) = 1 (coprime), or custom expression.
  3. Pick output format β€” JSON array of [i, j] pairs, CSV (i,j per row), or "i j" pairs separated by newlines.
  4. 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.

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.

Try it now​

The full integer-pairs runs in your browser at https://ztools.zaions.com/integer-pairs β€” no signup, no upload, no data leaves your device.

Open the tool β†—


Last updated: 2026-05-06 Β· Author: Ahsan Mahmood Β· Edit this page on GitHub