login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A376318
The number of distinct values of x+y+z (mod n) when x*y*z = 1 (mod n).
1
1, 1, 2, 1, 4, 2, 7, 2, 4, 4, 11, 2, 13, 7, 8, 3, 17, 4, 19, 4, 14, 11, 23, 4, 20, 13, 11, 7, 29, 8, 31, 6, 22, 17, 28, 4, 37, 19, 26, 8, 41, 14, 43, 11, 16, 23, 47, 6, 49, 20, 34, 13, 53, 11, 44, 14, 38, 29, 59, 8, 61, 31, 28, 11, 52, 22, 67, 17, 46, 28, 71, 8, 73, 37, 40, 19, 77, 26
OFFSET
1,3
COMMENTS
The values of n for which a(n) = n seem to be A007775, but I have no proof of this.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..30000
MAPLE
a:=proc(n)
local x, y, z, N;
N:=NULL;
for x from 0 to n-1 do
for y from x to n-1 do
for z from y to n-1 do
if (x*y*z) mod n = 1 mod n then N:=N, (x+y+z) mod n; fi;
od:
od:
od:
nops({N});
end:
PROG
(Python)
def A376318(n):
s = set()
for x in range(n):
for y in range(x, n):
try:
s.add((x+y+pow(x*y%n, -1, n))%n)
except:
continue
return len(s) # Chai Wah Wu, Sep 23 2024
(PARI) a(n)=my(v=vectorsmall(n)); for(x=1, n, if(gcd(x, n)>1, next); for(y=1, x, if(gcd(y, n)>1, next); my(z=1/Mod(x*y, n)); v[lift(x+y+z)+1]=1)); sum(i=1, n, v[i]) \\ Charles R Greathouse IV, Sep 23 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
W. Edwin Clark, Sep 22 2024
STATUS
approved