%I #32 Sep 09 2022 17:14:05
%S 0,0,2,10,10,16,22,40,56,48,70,64,66,74,114,130,118,122,138,168,220,
%T 174,158,270,242,242,234,212,238,308,284,272,334,296,318,332,424,364,
%U 368,416,370,470,524,510,464,474,552,542,480,604,586,554,768,578,752,618,628,880,752,634,702,606,846
%N a(n) is the number of total solutions (minus the n-th prime) to x^y == y^x (mod p) where 0 < x,y <= p and p is the n-th prime.
%H Chai Wah Wu, <a href="/A355486/b355486.txt">Table of n, a(n) for n = 1..1000</a>
%F a(n) = A355419(n) - A000040(n).
%F a(n) = 2*(number of solutions to x^y == y^x (mod p) where 1 < x < y < p). - _Chai Wah Wu_, Aug 30 2022
%p f:= proc(n) local p,x,y,t;
%p p:= ithprime(n);
%p t:= 0;
%p for x from 2 to p-1 do
%p for y from x+1 to p-1 do
%p if x&^y - y&^x mod p = 0 then t:= t+1 fi
%p od od:
%p 2*t
%p end proc:
%p map(f, [$1..100]); # _Robert Israel_, Aug 31 2022
%o (Python)
%o from sympy import prime
%o def f(n):
%o S = 0
%o for x in range(1, n + 1):
%o for y in range(x + 1 , n + 1):
%o if ((pow(x, y, n) == pow(y, x, n))):
%o S += 2
%o return S
%o def a(n): return f(prime(n))
%o (Python)
%o from sympy import prime
%o def A355486(n):
%o p = prime(n)
%o 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
%Y Cf. A000040, A355419.
%K nonn
%O 1,3
%A _DarĂo Clavijo_, Jul 04 2022
%E More terms from _Robert Israel_, Aug 31 2022