%I #47 Nov 19 2021 02:49:52
%S 3,5,17,347,13901,665111,128981,113575727,2426256797,137168442221,
%T 4656625081181,101951758179851,484511389338941,221860944705726407
%N a(n) is the smallest prime p, such that p + k + k^2 are consecutive primes for 0 <= k <= n, but not for k>n.
%C a(n) is the smallest prime followed by exactly n prime gaps in arithmetic progression with a common difference of 2 and starting with prime gap 2.
%e a(4)=347, because it is the smallest prime such that 347 + 2 = 349, 349 + 4 = 353, 353 + 6 = 359, 359 + 8 = 367 are 5 consecutive primes.
%t Table[k=2;While[Flatten[k+(s={Range[0,n]})+s^2]!=NextPrime[k,Range[0,n]]||NextPrime[k,n+1]==k+n+1+(n+1)^2,k=NextPrime@k];k,{n,7}] (* _Giorgos Kalogeropoulos_, Nov 10 2021 *)
%o (PARI) isok(p, n) = my(q=p); for (k=1, n, my(r = p+k+k^2); if (nextprime(q+1) != r, return (0)); q=r); return(1);
%o a(n) = my(p=2); while (!isok(p, n), p=nextprime(p+1)); p; \\ _Michel Marcus_, Nov 09 2021
%Y Cf. A016045, A001223 (prime gaps), A036263 (2nd differences), A158939 (monotonic increasing).
%K nonn,more
%O 1,1
%A _Marc Morgenegg_, Nov 08 2021