Skip to content

numrange

A numrange specifies a set of numbers or number pairs, triples, quadruples, quintuples, or sextuples used as a question source.

Integer ranges

2-9        → {2, 3, 4, 5, 6, 7, 8, 9}
5          → {5}
2-6,12-18  → {2, 3, 4, 5, 6, 12, 13, 14, 15, 16, 17, 18}

Filters

Filters are appended with brackets and narrow down the preceding atom:

2-30[5]    → multiples of 5 in 2–30: {5, 10, 15, 20, 25, 30}
2-30[^5]   → integers in 2–30 that are NOT multiples of 5
2-30[3+1]  → integers in 2–30 congruent to 1 mod 3: {4, 7, 10, 13, 16, 19, 22, 25, 28}
2-30[^3+1] → integers in 2–30 NOT congruent to 1 mod 3

Filters can be chained:

2-100[^15][2]   → even numbers in 2–100, excluding multiples of 15

Decimal ranges

0.2-0.9    → {0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}

Both bounds must share the same decimal precision; the step is inferred from it.

A filter can use a decimal modulus matching that precision:

0.1-0.9[0.3]   → multiples of 0.3 in 0.1–0.9: {0.3, 0.6, 0.9}

Cartesian products

× (or *) creates ordered products (e.g. pairs (a, b) with a ≤ b), drawn from several ranges:

2-9×2-9                    → all pairs (a, b) with 2 ≤ a ≤ b ≤ 9
5×2-9                      → pairs (5, b) for b in {2, …, 9}
0.001-9.999×10,100,1000    → pairs (x, m) for x in 0.001–9.999, m in {10, 100, 1000}
2-9×2-9×2-9                → all triples (a, b, c) with 2 ≤ a ≤ b ≤ c ≤ 9

When one factor is a single value (a singleton), it stays fixed in its position and the a ≤ b ordering no longer applies: 5×2-9 yields (5, 2), (5, 3), …, (5, 9), including pairs whose second value is smaller.

Global filters

A filter placed after a parenthesised product is applied independently to each range of the product:

(2-9×2-9)[2]    → pairs (a, b), a ≤ b, with a and b both even (2–9)
(2-9×2-9)[^3]   → pairs (a, b), a ≤ b, with neither value a multiple of 3

This differs from a filter local to a single range: 2-9[2]×2-9 would filter only the first range, and 2-9×2-9[2] only the second.