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.

A257789 Numbers n such that 2n*prime(n) - 1 and 2n*prime(n) + 1 are both prime.

This page as a plain text file.
%I A257789 #21 Sep 08 2022 08:46:12
%S A257789 1,2,3,24,30,33,54,90,156,168,189,225,294,300,402,576,741,780,825,849,
%T A257789 918,948,978,1014,1245,1542,1551,1608,1614,1617,1770,1773,1908,1914,
%U A257789 1920,1947,2025,2286,2361,2370,2598,2760,2865,2970,3081,3516,3744,3759,3948,4023
%N A257789 Numbers n such that 2n*prime(n) - 1 and 2n*prime(n) + 1 are both prime.
%C A257789 a(n) is divisible by 3 for n >= 3. - _Robert Israel_, May 08 2015
%H A257789 Charles R Greathouse IV, <a href="/A257789/b257789.txt">Table of n, a(n) for n = 1..10000</a>
%e A257789 2 is in this sequence because 2*2*prime(2) - 1 = 11 and 2*2*prime(2) + 1 = 13 are both prime.
%p A257789 filter:= proc(n)
%p A257789 local p;
%p A257789 p:= ithprime(n);
%p A257789 isprime(2*n*p+1) and isprime(2*n*p-1)
%p A257789 end proc:
%p A257789 select(filter, [1,2,seq(3*j,j=1..10^5)]); # _Robert Israel_, May 08 2015
%t A257789 Select[Range[3000], PrimeQ[2 # Prime[#] - 1] && PrimeQ[2 #  Prime[#] + 1] &] (* _Vincenzo Librandi_, May 09 2015 *)
%t A257789 Select[Range[4200],AllTrue[2# Prime[#]+{1,-1},PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Dec 08 2018 *)
%o A257789 (Magma) [n: n in [1..4500] | IsPrime(2*n*NthPrime(n)-1) and IsPrime(2*n*NthPrime(n)+1)];
%o A257789 (PARI) v=List(); n=0; forprime(p=2,1e5, n++; if(isprime(2*n*p-1) && isprime(2*n*p+1), listput(v,n))); Vec(v) \\ _Charles R Greathouse IV_, May 08 2015
%Y A257789 Cf. A085637.
%K A257789 nonn,easy
%O A257789 1,2
%A A257789 _Juri-Stepan Gerasimov_, May 08 2015