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.

A376240 a(n) = number of {x,y,z} in Z/nZ such that x+y+z = x*y*z is nonzero.

Original entry on oeis.org

0, 1, 0, 1, 4, 2, 6, 6, 6, 21, 18, 7, 30, 30, 22, 28, 50, 37, 56, 63, 30, 86, 84, 42, 120, 145, 72, 87, 144, 124, 154, 140, 98, 245, 188, 123, 234, 274, 176, 274, 286, 169, 300, 253, 270, 410, 360, 196, 336, 607, 308, 437, 476, 388, 520, 378, 344, 709, 570, 429, 630, 758, 372, 600, 882, 517, 736, 751, 524, 968, 828, 546, 900, 1153, 810, 839, 720, 912, 1026, 1140, 738, 1413, 1134, 585, 1502, 1482, 930
Offset: 1

Views

Author

M. F. Hasler, Sep 24 2024

Keywords

Comments

Similar to A376183, but the sum equal to the product is restricted to be nonzero, as to exclude many rather trivial solutions.
Counting sets {x, y, z} means that the order of the three (not necessarily distinct) values is irrelevant. Equivalently, one could use representatives with, e.g., x <= y <= z.

Examples

			For n=1, we can't have x+y+z = x*y*z nonzero because zero is the only element, so there are a(1) = 0 solutions.
For n=2, x+y+z = x*y*z != 0 implies x = y = z = 1 (in Z/2Z), so there is only one unique solution, and a(2) = 1.
For n=3, x+y+z = x*y*z != 0 is impossible: if x = y = z, the sum is zero (in Z/3Z), and 1 + 2 + z = 1*2*z <=> z = 0, so there is no solution, a(3) = 0.
For n=4, since 2*2 = 0 in Z/4Z, at most one among {x, y, z}, say z, can equal 2. In this case, x = -y = +-1, gives a solution {x, y, z} = {1, 2, 3}. One then checks that x = +-y = z = +-1 can't yield a solution, so a(4) = 1.
For n=5, we see that (x, y) = (2, 3) gives z = z, so we have a solution for any nonzero z, and exhaustive verification shows that these are no other solutions: a(5) = 4.
		

Crossrefs

Cf. A376183 (same without restriction to nonzero sum/product).

Programs

  • PARI
    apply( {A376240(n)=sum(x=1,n-1,sum(y=1,x,sum(z=1,y, (x+y+z-x*y*z)%n==0 && x*y*z%n)))}, [1..99])
    
  • Python
    def A376240(n):
        c = 0
        for x in range(1,n):
            for y in range(x,n):
                xy,xyp = x*y%n-1,n-(x+y)%n
                c += sum(not (z==xyp or (xy*z+xyp)%n) for z in range(y,n))
        return c # Chai Wah Wu, Sep 30 2024