login

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”).

Smallest k>0 such that n-k, n+k, 3n-k and 3n+k are all primes, or 0 if no such k exisis.
0

%I #7 Apr 26 2012 15:08:16

%S 0,0,0,1,2,1,0,5,4,7,0,5,0,0,2,0,0,13,0,0,10,0,0,0,22,0,20,25,0,7,0,0,

%T 10,0,32,5,0,35,20,0,0,25,0,0,22,0,0,5,0,47,46,0,0,35,0,0,40,0,0,1,0,

%U 0,10,0,0,35,0,0,0,0,0,25,0,0,14,0,0,5,0,77

%N Smallest k>0 such that n-k, n+k, 3n-k and 3n+k are all primes, or 0 if no such k exisis.

%e a(4)=1 because 4-1=3, 4+1=5, 3*4-1=11 and 3*4+1=13 are all primes,

%e a(5)=2 because 5-2=3, 5+2=7, 3*5-2=13 and 3*5+2=17 are all primes.

%t Table[k = 0; While[k < n && ! (PrimeQ[n - k] && PrimeQ[n + k] && PrimeQ[3 n - k] && PrimeQ[3 n + k]), k++]; If[k == n, 0, k], {n, 100}] (* _T. D. Noe_, Apr 26 2012 *)

%K nonn

%O 1,5

%A _Gerasimov Sergey_, Apr 26 2012