OFFSET
0,3
COMMENTS
Matrix multiplication of A and B is commutative here.
If A + B = A * B then (A - I)*(B - I) = I, where I is the identity matrix. For integer matrices, the determinant of (A-I) must be +-1 and its inverse gives B-I. - Andrew Howroyd, Nov 12 2024
LINKS
Stuart E Anderson, C++ program for NxN solutions
Math Stackexchange, If A+B=AB, A,B commute
EXAMPLE
One of the 72 solutions in 3x3 (1,0) matrices:
A = {{0,0,0},{0,1,1},{1,1,1}},
B = {{0,0,0},{1,1,1},{0,1,1}}
A + B = {{0,0,0},{1,2,2},{1,2,2}}
A * B = {{0,0,0},{1,2,2},(1,2,2}}
PROG
(PARI) \\ See comments. Uses Gray code to generate A-I (called A here).
a(n)= { my(Id=matid(n), A=-Id); sum(f=0, 2^(n^2)-1, if(f, my(t=valuation(f, 2), i=t\n+1, j=t%n+1); A[i, j]=if(i==j, -1, 1)-A[i, j]); if(abs(matdet(A))==1, my(B=A^(-1)+Id); vecmin(B)>=0 && vecmax(B)<=1 && denominator(B)==1)) } \\ Andrew Howroyd, Nov 12 2024
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Stuart E Anderson, Nov 10 2024
EXTENSIONS
a(4) corrected and a(5) from Andrew Howroyd, Nov 12 2024
STATUS
approved