subroutine H_Inverse_Exact(n, Hinv)
! Inversa exacta a matricii Hilbert de ordinul "n"
! hij^(-1) =(-1)^(i+j)*(i+j-1)*comb(n+i-1, n-j)*comb(n+j-1, n-i)*(comb(i+j-2,i-1))^2

real :: Hinv(n,n)
character*20 fname, charn*2
real numer
!integer fact

Hinv =0

ido: do i=1, n

jdo: do j=1, n

Hinv(i,j) = (i+j-1)*comb(n+i-1, n-j)*comb(n+j-1, n-i)*(comb(i+j-2,i-1))**2

if(mod(i+j,2) /=0) then
Hinv(i,j) =-Hinv(i,j)
endif

enddo jdo
enddo ido

END subroutine H_Inverse_Exact
