Enter a whole number n from 1 to 1,000 to add the products of every distinct unordered pair chosen from 1, 2, …, n. Each pair is counted once: 2 × 3 is included, but 3 × 2 is not counted again. Self-pairs such as 2 × 2 are excluded.
Let S = 1 + 2 + … + n and Q = 1² + 2² + … + n². Expanding S² includes each square once and each distinct pair product twice. Thus S² = Q + 2P, where P is the desired sum.
Subtract Q and divide by 2 to obtain P = (S² − Q)/2. Substituting S = n(n + 1)/2 and Q = n(n + 1)(2n + 1)/6 gives the formula above. The calculator evaluates this identity without listing every pair.
The six pairs are (1, 2), (1, 3), (1, 4), (2, 3), (2, 4) and (3, 4). Their products add to 2 + 3 + 4 + 6 + 8 + 12 = 35.
Using the formula, S = 10 and Q = 30, so P = (10² − 30)/2 = 35.
| n | Number of unordered pairs | Sum of pairwise products |
|---|---|---|
| 1 | 0 | 0 |
| 2 | 1 | 2 |
| 3 | 3 | 11 |
| 4 | 6 | 35 |
| 5 | 10 | 85 |
| 10 | 45 | 1320 |
Use whole numbers from 1 to 1,000. Fractional inputs do not represent a sequence of integers from 1 to n. The upper bound keeps the intermediate integer calculations within the exact integer range of standard floating-point arithmetic.
For n = 1, there are no distinct pairs, so the sum is 0. An unavailable calculation is not a zero result; correct any invalid input before interpreting the output.
Does distinct mean that all resulting products must be different?
No. It means the two numbers in each pair are different. Different pairs can produce the same product, and both contributions count. For example, (1, 6) and (2, 3) each contribute 6 when n is at least 6.
How many pairs are included?
There are n(n − 1)/2 unordered pairs. Each pair contains two different integers selected from 1 through n.
What if I want ordered pairs?
If self-pairs are still excluded but both (i, j) and (j, i) count, multiply this calculator’s result by 2.

