title: Map N integers to [1,N]
body: <p>I'm looking for an efficient way to map a N integers to [1,N].</p>
  
  <p>The N integers are actually entries of a sorted array A with no redundancies, and my goal is to be able to simply access the index of every entry of the array.</p>
  
  <p>Example : </p>
  
  <p>For a given array A of integers, sorted and without redundancies, but with gaps and possibly very large numbers (you could have 1000 integers ranging from 25 to 10^6), I need a way of finding the index of every entry in an efficient way. For example if A[15] = 1546, I need to be able to do index(1546) = 15. 
  My problem is that I need to do this in Fortran, and as far as I know, there are no real hash table libraries.</p>