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

a(n) = n if A103689(n)*n +/- 1 are twin primes; a(n) = 0 otherwise.
1

%I #16 Sep 09 2014 20:49:30

%S 0,0,0,4,0,6,0,0,9,0,0,12,0,0,15,0,0,18,0,0,21,0,0,0,0,0,0,0,0,30,0,0,

%T 0,0,0,0,0,0,0,0,0,42,0,0,0,0,47,0,0,0,51,0,0,0,0,0,0,0,0,60,0,0,0,0,

%U 0,0,0,0,69,0,0,72,0,0,75,0,0,0,0,0,0,0

%N a(n) = n if A103689(n)*n +/- 1 are twin primes; a(n) = 0 otherwise.

%e For n=5 2*5-1=9 is not prime, 2*5+1=11 is prime so a(5)=0.

%e For n=6 1*6-1=5 is prime, 1*6+1=7 is prime, 5 and 7 are twin primes so a(6)=6.

%t lktp[n_]:=Module[{k=1},While[NoneTrue[k*n+{1,-1},PrimeQ],k++];If[AllTrue[k*n+{1,-1},PrimeQ],n,0]]; Array[lktp,100] (* The program uses the functions NoneTrue and AllTrue from Mathematica version 10 *) (* _Harvey P. Dale_, Sep 09 2014 *)

%o (PARI)

%o a(n)=k=1;while(!isprime(k*n+1)&&!isprime(k*n-1),k++);k

%o for(n=1,100,if(isprime(a(n)*n+1)&&isprime(a(n)*n-1),print1(n,", "));print1(0,", ")) \\ _Derek Orr_, Sep 09 2014

%Y Cf. A103689.

%K easy,nonn

%O 1,4

%A _Pierre CAMI_, Feb 12 2005

%E Corrected by _Harvey P. Dale_, Sep 09 2014

%E Definition simplified by _Derek Orr_, Sep 09 2014