cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A376318 The number of distinct values of x+y+z (mod n) when x*y*z = 1 (mod n).

Original entry on oeis.org

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

Views

Author

W. Edwin Clark, Sep 22 2024

Keywords

Comments

The values of n for which a(n) = n seem to be A007775, but I have no proof of this.

Crossrefs

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
    
Showing 1-1 of 1 results.