OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
a(3) = 4 because there are 4 solutions to x^y == 1 (mod 3): 1^1 == 1 (3), 1^2 == 1 (3), 1^3 == 1 (3), 2^2 == 1 (3).
MAPLE
f:= proc(n) local t, x, r;
t:= 0;
for x from 1 to n-1 do if igcd(n, x) = 1 then
r:= numtheory:-order(x, n);
t:= t + floor(n/r)
fi od;
t
end proc:
f(1):= 1:
map(f, [$1..100]): # Robert Israel, Mar 25 2020
MATHEMATICA
a[n_] := If[n == 1, 1, Sum[Boole[PowerMod[x, y, n] == 1], {x, 0, n - 1}, {y, 1, n}]];
Array[a, 100] (* Jean-François Alcover, Jun 08 2020 *)
PROG
(PARI) a(n) = sum(x=0, n-1, sum (y=1, n, Mod(x, n)^y == 1)); \\ Michel Marcus, Mar 20 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Franz Vrabec, Mar 18 2020
EXTENSIONS
More terms from Hugo Pfoertner, Mar 22 2020
STATUS
approved