The exponent of a group is the least common multiple of the orders of all elements in the group, but this has nothing to do with this problem. It's just to make the title start with E.
Little Ma gives you a positive integer $$$n$$$.
For each integer $$$a$$$ with $$$1 \le a \le n$$$, define $$$\operatorname{ord}_n(a)$$$ as the smallest positive integer $$$x$$$ satisfying:
$$$$$$ a^x \equiv 1 \pmod n $$$$$$
If no such positive integer $$$x$$$ exists, define $$$\operatorname{ord}_n(a)=0$$$.
Compute:
$$$$$$ \sum_{a=1}^{n}\operatorname{ord}_n(a) $$$$$$
Regarding $$$\equiv$$$: $$$\equiv$$$ is the congruence symbol in number theory. For three integers $$$a, b, p$$$, the mathematical expression $$$a \equiv b \pmod p$$$ is equivalent to the existence of an integer $$$k$$$ satisfying $$$a - b = kp$$$.
The first line contains an integer $$$T$$$ $$$(1\leq T\leq 10^3)$$$, the number of test cases.
Each of the next $$$T$$$ lines contains one positive integer $$$n$$$ $$$(1\leq n\leq 10^9)$$$.
For each test case, output one integer in a single line: the required sum.
5158549653618
11171839856882167209
54824816
4713723