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.
%I A376240 #19 Oct 02 2024 12:25:46 %S A376240 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, %T A376240 145,72,87,144,124,154,140,98,245,188,123,234,274,176,274,286,169,300, %U A376240 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 %N A376240 a(n) = number of {x,y,z} in Z/nZ such that x+y+z = x*y*z is nonzero. %C A376240 Similar to A376183, but the sum equal to the product is restricted to be nonzero, as to exclude many rather trivial solutions. %C A376240 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. %H A376240 Chai Wah Wu, <a href="/A376240/b376240.txt">Table of n, a(n) for n = 1..7542</a> %e A376240 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. %e A376240 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. %e A376240 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. %e A376240 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. %e A376240 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. %o A376240 (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]) %o A376240 (Python) %o A376240 def A376240(n): %o A376240 c = 0 %o A376240 for x in range(1,n): %o A376240 for y in range(x,n): %o A376240 xy,xyp = x*y%n-1,n-(x+y)%n %o A376240 c += sum(not (z==xyp or (xy*z+xyp)%n) for z in range(y,n)) %o A376240 return c # _Chai Wah Wu_, Sep 30 2024 %Y A376240 Cf. A376183 (same without restriction to nonzero sum/product). %K A376240 nonn %O A376240 1,5 %A A376240 _M. F. Hasler_, Sep 24 2024