Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #19 Dec 28 2015 16:58:12
%S 2,3,43,2,7,3,61,23,17,5,109,73,67,37,19,7,3,127,73,67,31,2,277,7,3,
%T 79,89,47,53,19,13,5,151,157,1033,73,61,31,37,307,397,1129,163,3,103,
%U 97,613,2,587,37,13,7,197,1009,107,137,73,613,43,23,29,13,7,193
%N Smallest prime(k) such that prime(k+n) - prime(k) is a perfect square.
%C The corresponding indices k are in A196815.
%H Robert Israel, <a href="/A196874/b196874.txt">Table of n, a(n) for n = 1..10000</a>
%e a(3) = 43 is the smallest initial prime of a subset of 4 consecutive primes {43, 47, 53, 59} such that 59 - 43 = 16 = 4^2.
%p A196874:= proc(n)
%p for k from 1 do
%p if issqr(ithprime(k+n)-ithprime(k)) then
%p return ithprime(k);
%p end if;
%p end do:
%p end proc:
%p seq(A196874(n), n=1..80) ; # (see A196815) _R. J. Mathar_, Oct 06 2011
%t spk[n_]:=Module[{k=1},While[!IntegerQ[Sqrt[Prime[n+k]-Prime[k]]],k++];Prime[k]]; Array[spk,70] (* _Harvey P. Dale_, Jul 23 2012 *)
%o (PARI) a(n) = {my(k=1); while (! issquare(prime(k+n)- prime(k)), k++); prime(k);} \\ _Michel Marcus_, Dec 28 2015
%Y Cf. A000040, A196815.
%K nonn
%O 1,1
%A _Michel Lagneau_, Oct 07 2011