A376318 The number of distinct values of x+y+z (mod n) when x*y*z = 1 (mod n).
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
Keywords
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..30000
- Charles R Greathouse IV, Program for computing terms (C with PARI)
Programs
-
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:
-
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
-
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
Comments