← Complete problem index

PROJECT EULER · #0789

Minimal Pairing Modulo p

Statement only · UnsolvedOriginal problem ↗

Given an odd prime p, put the numbers 1,...,p1 into p12 pairs such that each number appears exactly once. Each pair (a,b) has a cost of abmodp. For example, if p=5 the pair (3,4) has a cost of 12mod5=2.

The total cost of a pairing is the sum of the costs of its pairs. We say that such pairing is optimal if its total cost is minimal for that p.

For example, if p=5, then there is a unique optimal pairing: (1,2),(3,4), with total cost of 2+2=4.

The cost product of a pairing is the product of the costs of its pairs. For example, the cost product of the optimal pairing for p=5 is 22=4.

It turns out that all optimal pairings for p=2000000011 have the same cost product.

Find the value of this product.

Write-up coming later

The complete problem is available here. An approach, code, and answer will be added later.