|
|
A355419
|
|
a(n) is the number of solutions to x^y == y^x (mod p) where 0 < x,y <= p and p is the n-th prime.
|
|
3
|
|
|
2, 3, 7, 17, 21, 29, 39, 59, 79, 77, 101, 101, 107, 117, 161, 183, 177, 183, 205, 239, 293, 253, 241, 359, 339, 343, 337, 319, 347, 421, 411, 403, 471, 435, 467, 483, 581, 527, 535, 589, 549, 651, 715, 703, 661, 673, 763, 765, 707, 833, 819, 793, 1009, 829
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
FORMULA
|
a(n) = p+2*(number of solutions to x^y == y^x (mod p) where 1 < x < y < p). - Chai Wah Wu, Aug 30 2022
|
|
EXAMPLE
|
Solutions for a(3):
p x y x^y mod p y^x mod p
- - - --------- ---------
5 1 1 1 1
5 2 2 4 4
5 2 4 1 1
5 3 3 2 2
5 4 2 1 1
5 4 4 1 1
5 5 5 0 0
Total number of solutions: 7.
|
|
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 + n
def a(n): return f(prime(n))
(Python)
from sympy import prime
def A355419(n): return (p:=prime(n))+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
(PARI) a(n) = my(p=prime(n)); sum(x=1, p, sum(y=1, p, Mod(x, p)^y == Mod(y, p)^x)); \\ Michel Marcus, Jul 05 2022
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|