login
Smallest k > 1 such that A014574(n)*k is in A014574.
2

%I #14 Dec 17 2020 11:53:54

%S 3,2,5,4,2,10,3,6,10,4,6,4,9,6,15,21,13,3,15,6,6,8,6,5,4,11,5,26,6,2,

%T 2,6,6,11,4,5,4,6,14,6,20,9,46,5,9,4,14,11,9,20,21,6,6,4,6,14,4,9,9,3,

%U 21,5,35,15,14,2,5,30,36,4,5,14,2,29,21,10,39,8,4,5,9,3

%N Smallest k > 1 such that A014574(n)*k is in A014574.

%H Robert Israel, <a href="/A307775/b307775.txt">Table of n, a(n) for n = 1..10000</a>

%p P:= select(isprime, {seq(i,i=3..10^7,2)}):

%p A14574:= sort(convert(map(`+`,P,1) intersect map(`+`,P,-1),list)):

%p f:= proc(n) local k,v,kv;

%p v:= A14574[n]:

%p for k from 2 do

%p kv:= k*v;

%p if kv > 10^7 then if isprime(kv-1) and isprime(kv+1) then return k fi

%p elif member(kv,A14574) then return k

%p fi

%p od

%p end proc:

%p map(f, [$1..100]); # _Robert Israel_, Dec 17 2020

%t twinMidQ[n_] := AllTrue[{-1, 1} + n, PrimeQ]; f[n_] := Module[{k = 2}, While[! twinMidQ[k*n], k++]; k]; f /@ Select[Range[10^3], twinMidQ] (* _Amiram Eldar_, Jul 05 2019 *)

%o (PARI) isok2(n) = isprime(n-1) && isprime(n+1);

%o k(n) = my(k=2); while (! isok2(n*k), k++); k;

%o lista(nn) = for (n=1, nn, if (isok2(n), print1(k(n), ", "))); \\ _Michel Marcus_, Apr 28 2019

%Y Cf. A014574.

%K nonn

%O 1,1

%A _Dmitry Kamenetsky_, Apr 28 2019