OFFSET
1,3
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = 2*(number of solutions to x^y == y^x (mod p) where 1 < x < y < p). - Chai Wah Wu, Aug 30 2022
MAPLE
f:= proc(n) local p, x, y, t;
p:= ithprime(n);
t:= 0;
for x from 2 to p-1 do
for y from x+1 to p-1 do
if x&^y - y&^x mod p = 0 then t:= t+1 fi
od od:
2*t
end proc:
map(f, [$1..100]); # Robert Israel, Aug 31 2022
PROG
(Python)
from sympy import prime
def f(n):
S = 0
for x in range(1, n + 1):
for y in range(x + 1 , n + 1):
if ((pow(x, y, n) == pow(y, x, n))):
S += 2
return S
def a(n): return f(prime(n))
(Python)
from sympy import prime
def A355486(n):
p = prime(n)
return sum(2 for x in range(2, p-1) for y in range(x+1, p) if pow(x, y, p)==pow(y, x, p)) # Chai Wah Wu, Aug 30 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Darío Clavijo, Jul 04 2022
EXTENSIONS
More terms from Robert Israel, Aug 31 2022
STATUS
approved