0%

Problem 784


Problem 784


Reciprocal Pairs

Let’s call a pair of positive integers $p$, $q$ ($p \lt q$) reciprocal, if there is a positive integer $r\lt 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 $p \le N$.

$F(5)=59$ due to these four reciprocal pairs $(3,5)$, $(4,11)$, $(5,7)$ and $(5,19)$.

You are also given $F(10^2) = 697317$.

Find $F(2\cdot 10^6)$.


模倒数对

对于正整数$p$和$q$(满足$p \lt q$),若存在正整数$r \lt p$使得$r$同时是$p$同余$q$的逆元和$q$同余$p$的逆元,则称这两个正整数互为模倒数

例如,$(3,5)$是一组模倒数对,其对应的$r=2$。

对所有满足$p\le N$的模倒数对$(p,q)$,记$F(N)$为所有$p+q$之和。

例如,$F(5)=59$,因为共有四组模倒数对$(3,5)$、$(4,11)$、$(5,7)$和$(5,19)$。

已知$F(10^2) = 697317$。

求$F(2\cdot 10^6)$。