%I
%S 27,6,13,1,31,4,54,8,3,100,5,25,155,28,9,16,243,19,49,288,21,62,24,12,
%T 75,422,81,444,84,2,112,37,580,11,634,47,53,150,57,60,788,20,840,183,
%U 872,10,14,218,1029,228,80,1074,26,87,92,99,1237,103,281,1319,29,15,314,1498,323
%N Location of the nth prime in its Andrica ranking.
%C For each consecutive prime pair p < q, d = sqrt(q)  sqrt(p) is unique. Place d in order from greatest to least and specify p.
%C Last appearance by prime index: 1, 5, 7, 10, 13, 17, 20, 26, 28, 33, 35, 41, 43, 45, 49, ..., .
%C Last appearance of a minimum prime by Andrica ranking: 2, 11, 17, 29, 41, 59, 71, 101, 107, 137, 149, 179, ..., .
%C As expected, this sequence is the lesser of the twin primes beginning with the second term, 11. See A001359.
%H Marek Wolf, <a href="http://arxiv.org/abs/1010.3945">A Note on the Andrica Conjecture</a>
%e a(1)=27 since the first prime, 2, does not show up in the ranking until the 27th term. See A218013.
%e a(4)=1 since the fourth prime, 7, has the maximum A_n value, see A218012; i.e., sqrt(p_n)sqrt(p_n+1) is at a maximum.
%t lst = {}; p = 2; q = 3; While[p < 1600000, If[ Sqrt[q]  Sqrt[p] > 1/20, AppendTo[lst, {p, Sqrt[q]  Sqrt[p]}]]; p = q; q = NextPrime[q]]; lsu = First@ Transpose@ Sort[lst, #1[[2]] > #2[[2]] &]; Table[ Position[lsu, p, 1, 1], {p, Prime@ Range@ 65}] // Flatten
%Y Cf. A079296, A218012, A218015.
%K nonn
%O 1,1
%A Marek Wolf) and _Robert G. Wilson v_, Oct 18 2012
