title: Find the indices of the two largest and not consecutive values
body: <p>Given the following vector,</p>
  <pre><code>a = [0, 11, 22, 10, 5, 6, 7, 8, 9, 23, 25, 18, 10]
  </code></pre>
  <p>I need to identify the indices of &quot;a&quot; whose elements are the two largest not consecutive values like this:</p>
  <pre><code>idx = [2, 10] 
  </code></pre>
  <p>(a[2] = 22; a[10] = 25).</p>
  <p>Moreover it will be possible to set a minimum distance gap (my_gap) between these finding numbers; for example in the followin vector,</p>
  <pre><code>a = [10, 11, 14, 28, 10, 30, 8, 11, 13, 11, 28, 10]
  </code></pre>
  <p>I would like to have: <code>idx= [5, 10]</code> because I want a gap in positions between the largest values of at least 3. In the example the first '28' is too close the the '30' (they differ of 5-2=3 positions, the other '28' is farther from the '30' --&gt;abs(5-10) = 5 &gt; my_gap).</p>
  <p>To be more precise and avoid misunderstandings is there any pythonic way to rewrite the following code?
  Thanks</p>
  <pre><code>import numpy as np
  
  a = [60, 2, 3, 21, 18, 22, 0, 70, 118, 111, 100, 120, 10, 6]
  idx = np.argsort(a)[::-1]
  a_sorted = np.sort(a)[::-1]
  n_gap = 3
  
  first_value = a_sorted[0]
  second_value = []
  for i in range(1, len(idx)):
      if abs(idx[0] - idx[i]) &gt; n_gap:
          second_value = a_sorted[i]
          break
  print('first value: ', first_value)
  print('second value: ', second_value)
  </code></pre>