%I #20 Jul 17 2019 18:43:46
%S 2,2,2,2,2,2,3,5,3,4,2,3,2,2,2,2,2,2,2,3,5,2,2,4,3,3,2,2,2,2,2,3,2,4,
%T 3,2,2,2,3,6,3,2,2,2,3,4,2,2,2,3,2,3,3,4,3,4,4,5,2,3,4,2,3,2,3,2,2,4,
%U 3,2,2,5,2,4,4,4,4,3,2,5,2,3,4,2,4,4,2,2,2,4,2,6,4,2,2,5,4,6
%N Smallest k > 1 such that A014574(n)*k is adjacent to a prime.
%C It is perhaps surprising that the values in this sequence are so small. For n < 8000 the largest value of a(n) is 20, which occurs for n = 4928. Also for n < 8000, a(n) is 2 on 2449 occasions.
%C a(n)=2 if and only if A014574(n)+1 is in A038869 or A014574(n)-1 is in A045536. - _Robert Israel_, Jul 17 2019
%H Robert Israel, <a href="/A307833/b307833.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = A309120(A014574(n)). - _Robert Israel_, Jul 17 2019
%e 72*5 = 360, which is adjacent to the prime 359, so a(8) = 5.
%p P:= {seq(ithprime(i),i=1..10^4)}:
%p A014574:= sort(convert(map(t -> t+1, P intersect map(`-`,P,2)),list)):
%p f:= proc(m) local k;
%p for k from 2 do
%p if isprime(k*m-1) or isprime(k*m+1) then return k fi
%p od
%p end proc:
%p map(f, A014574); # _Robert Israel_, Jul 17 2019
%t primeNearQ[n_] := AnyTrue[{-1, 1} + n, PrimeQ]; twinMidQ[n_] := AllTrue[{-1, 1} + n, PrimeQ]; f[n_] := Module[{k = 2}, While[! primeNearQ[k*n], k++]; k]; f /@ Select[Range[10^4], twinMidQ] (* _Amiram Eldar_, Jul 05 2019 *)
%o (PARI) isok2(n) = isprime(n-1) && isprime(n+1);
%o k(n) = my(k=2); while (! (isprime(n*k-1) || isprime(n*k+1)), k++); k;
%o lista(nn) = for (n=1, nn, if (isok2(n), print1(k(n), ", "))); \\ _Michel Marcus_, May 01 2019
%Y Cf. A014574, A038869, A045536, A307775, A309120.
%K nonn
%O 1,1
%A _Dmitry Kamenetsky_, May 01 2019