← Complete problem index

PROJECT EULER · #0784

Reciprocal Pairs

Statement only · UnsolvedOriginal problem ↗

Let's call a pair of positive integers p, q (p<q) reciprocal, if there is a positive integer r<p such that r equals both the inverse of p modulo q and the inverse of q modulo p.

For example, (3,5) is one reciprocal pair for r=2.
Let F(N) be the total sum of p+q for all reciprocal pairs (p,q) where pN.

F(5)=59 due to these four reciprocal pairs (3,5), (4,11), (5,7) and (5,19).
You are also given F(102)=697317.

Find F(2106).

Write-up coming later

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