%I #26 Sep 04 2019 01:55:38
%S 6,114,162,210,24,330,6,6,18,12,30,210,6,18,120,150,330,24,6,42,30,66,
%T 96,210,180,210,42,54,60,360,6,18,630,60,210,24,30,66,24,126,30,48,
%U 1380,24,90,102,6,30,42,18,90,90,42,54,12,36,60,186,210,12,72,24,42,24,330,60,12
%N a(n) is the least k>0 such that A001359(n)+k^2 is in A001359.
%C Offset is 2 because 3+k^2 is never in A001359.
%C All terms are divisible by 6.
%C The generalized Bunyakovsky conjecture implies that a(n) always exists, for n >= 2.
%C a(n) = 6 if and only if A001359(n) is in A248367.
%H Robert Israel, <a href="/A324669/b324669.txt">Table of n, a(n) for n = 2..10000</a>
%e a(3) = 114 because A001359(3)=11, 11+114^2=13007 is in A001359, and no smaller k works.
%p P:= select(isprime, {seq(i,i=3..10000,2)}):
%p TP:= sort(convert(P intersect map(`-`,P,2),list)):
%p f:= proc(p) local k;
%p for k from 6 by 6 do if isprime(p + k^2) and isprime(p + k^2 + 2) then return k fi od
%p end proc:
%p map(f, TP[2..-1]);
%t With[{s = Select[Prime@ Range[3, 332], PrimeQ[# + 2] &]}, Array[Block[{k = 1}, While[! AllTrue[s[[#]] + k^2 + {0, 2}, PrimeQ], k++]; k] &, Length@ s]] (* _Michael De Vlieger_, Sep 03 2019 *)
%Y Cf. A001359, A248367.
%K nonn
%O 2,1
%A _J. M. Bergot_ and _Robert Israel_, Sep 03 2019