cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A214498 Smallest k>=0 such that (3^n+k)*2^n-1 and (3^n+k)*2^n+1 are a twin prime pair.

This page as a plain text file.
%I A214498 #15 Jul 23 2013 16:57:36
%S A214498 0,6,3,12,78,18,18,141,18,54,78,132,138,78,57,537,237,6,972,219,81,
%T A214498 3369,69,501,2328,18,738,291,393,969,324,492,102,3291,1788,1401,891,
%U A214498 954,4017,309,702,1656,3999,1014,2346,4008,3,5001,2736,558,2262,969,762
%N A214498 Smallest k>=0 such that (3^n+k)*2^n-1 and (3^n+k)*2^n+1 are a twin prime pair.
%C A214498 Conjecture : there is always one such k for each n>0.
%C A214498 Heuristically, the average of a(n)/n^2 over n=1 to N tends to 1.2 as N increases.
%H A214498 Pierre CAMI, <a href="/A214498/b214498.txt">Table of n, a(n) for n = 1..500</a>
%p A214498 A214498 := proc(n)
%p A214498     local k;
%p A214498     for k from 0 do
%p A214498         p := (3^n+k)*2^n-1 ;
%p A214498         if isprime(p) and isprime(p+2) then
%p A214498             return k;
%p A214498         end if;
%p A214498     end do:
%p A214498 end proc: # _R. J. Mathar_, Jul 23 2012
%t A214498 sk[n_]:=Module[{n3=3^n,n2=2^n,k=0},While[!And@@PrimeQ[(n3+k)n2+{1,-1}], k++];k]; Array[sk,60] (* _Harvey P. Dale_, Jul 23 2013 *)
%o A214498 (PFGW64 and SCRIPTIFY)
%o A214498 SCRIPT
%o A214498 DIM nn,0
%o A214498 DIM kk
%o A214498 DIM jj
%o A214498 DIMS tt
%o A214498 OPENFILEOUT myfile,a(n).txt
%o A214498 OPENFILEOUT myf,b(n).txt
%o A214498 LABEL loopn
%o A214498 SET nn,nn+1
%o A214498 SET jj,0
%o A214498 IF nn>500 THEN END
%o A214498 SET kk,0
%o A214498 LABEL loopk
%o A214498 SET kk,kk+1
%o A214498 SETS tt,%d,%d\,;nn;kk
%o A214498 PRP (3^nn+kk)*2^nn-1,tt
%o A214498 IF ISPRP THEN GOTO a
%o A214498 IF ISPRIME THEN GOTO a
%o A214498 GOTO loopk
%o A214498 LABEL a
%o A214498 SET jj,jj+1
%o A214498 PRP (3^nn+kk)*2^nn+1,tt
%o A214498 IF ISPRP THEN GOTO d
%o A214498 IF ISPRIME THEN GOTO d
%o A214498 GOTO loopk
%o A214498 LABEL d
%o A214498 WRITE myfile,tt
%o A214498 SETS tt,%d,%d\,;nn;jj
%o A214498 WRITE myf,tt
%o A214498 GOTO loopn
%Y A214498 Cf. A214495-A214497.
%K A214498 nonn
%O A214498 1,2
%A A214498 _Pierre CAMI_, Jul 20 2012