
EXAMPLE

a(1)=3 as the prime gap [2] is repeated in the same order for 3>5 and 5>7.
a(2)=5 as the prime gaps [2, 4] are repeated for 5>7>11 and 11>13>17.
a(4)=839 as the prime gaps [14, 4, 2, 4] are repeated for the 2 consecutive sets of consecutive primes 839>853>857>859>863 and 863>877>881>883>887.


PROG

(PARI) findspg(n, vpg) = {for (k=1, #vpg2*n, pga = vector(n, i, vpg[k+i1]); pgb = vector(n, i, vpg[k+n+i1]); if (pga==pgb, return (k)); ); }
lista(nn=6, pp=10000000) = {vp = primes(pp); vpg = vector(pp1, i, vp[i+1]  vp[i]); for (n=1, nn, ip = findspg(n, vpg); if (ip>0, print1(prime(ip), ", ")); ); } \\ Michel Marcus, Oct 25 2014
