C Determinant of N*N integer (0,1)-matrix C How many different values can the determinant of a (0,1) matrix C assume, how many different (0,1) matrices have determinant 0? C This program allows to create small terms of the OEIS sequences C A003432, A046747, A051752, A086264 C C Hugo Pfoertner, http://www.pfoertner.org/ C Version history: C Oct 15 2003 Use Linpack subroutines to calculate determinant C Oct 5, 2003 Initial version C C IMPLICIT INTEGER (A-Z) C 64bit Integers required to create 6*6 and larger matrices IMPLICIT INTEGER*8 (A-Z) PARAMETER (N=6,NN=N*N) DOUBLEPRECISION D, DET(2), A(N,N), AA(NN), WORK(N) DIMENSION C(-NN:NN), IPVT(N) LOGICAL*1 BSET INTEGER*1 BIT EQUIVALENCE (BSET,BIT) EQUIVALENCE (A,AA) C DMAX = -1 DO 10 I = -NN, NN C(I) = 0 10 CONTINUE DO 110 I = 0, 2**(N*N)-1 DO 120 J = 0, N*N-1 BSET = BTEST(I,J) AA(J+1) = DBLE(BIT) 120 CONTINUE C C Determinant (using Linpack subroutines) call dgefa ( aa, n, n, ipvt, info ) call dgedi ( aa, n, n, ipvt, det, work, 10 ) ND = NINT(det(1) * 10.0D0**det(2)) C C(ND) = C(ND) + 1 IF ( ABS(ND) .GE. DMAX ) THEN IF ( ABS(ND) .GT. DMAX ) NDMC = 0 NDMC = NDMC + 1 IF ( MOD ( NDMC, 100000 ) .EQ. 0 ) WRITE (*,*) ND, NDMC DMAX = ABS(ND) ENDIF 110 CONTINUE C if ( d .eq. 1 ) write (41,1041) (a(k),k=1,n*n) C1041 format ( 40 I2 ) DO 900 I = -NN,NN IF ( C(I) .NE. 0 ) WRITE (*,*) I, C(I) 900 CONTINUE END C*************************************************************** Output for n=6: -9 529200 -8 5014800 -7 6438600 -6 46569600 -5 63612360 -4 418703040 -3 768723480 -2 3868663680 -1 9240051240 0 39882864736 (=A046747(6)) 1 9240051240 (=A086264(6)) 2 3868663680 3 768723480 4 418703040 5 63612360 6 46569600 7 6438600 8 5014800 9 (=A003432(6)) 529200 (=A051752(6))