Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #14 Jan 01 2021 11:26:40
%S 2,6,6,2,2,6,6,24,12,24,20,12,12,28,12,24,66,20,24,6,6,6,14,36,2,14,
%T 20,8,18,12,54,6,38,102,10,120,42,28,42,38,8,20,2,18,10,12,2,6,6,114,
%U 32,36,4,24,12,120,36,14,32,18,8,74,20,54,30,90,36,6,6,54,30,40,6,6,24,26,32,8,12,12
%N a(n) is the least k > 0 such that k*prime(n)+prime(n-1) and k*prime(n)+prime(n+1) are both prime.
%C All terms are even.
%C a(n) = 2 if and only if prime(n) is in A125146.
%H Robert Israel, <a href="/A340212/b340212.txt">Table of n, a(n) for n = 3..10000</a>
%e For n=3, prime(2)=3, prime(3)=5, prime(4)=7, and 2*5+3=13 and 2*5+7=17 are prime, so a(3)=2.
%p f:= proc(n) local p, q, r, k;
%p p:= ithprime(n);
%p q:= ithprime(n-1);
%p r:= ithprime(n+1);
%p for k from 2 by 2 do
%p if isprime(k*p+q) and isprime(k*p+r) then return k fi
%p od
%p end proc:
%p map(f, [$3..100]);
%o (PARI) a(n) = my(p=prime(n), k=1); while (! (isprime(k*p+precprime(p-1)) && isprime(k*p+nextprime(p+1))), k++); k; \\ _Michel Marcus_, Jan 01 2021
%Y Cf. A125146, A340210, A340214.
%K nonn
%O 3,1
%A _J. M. Bergot_ and _Robert Israel_, Dec 31 2020