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”).
%I #17 Sep 26 2020 19:41:39
%S 2,3,5,7,11,19,23,29,31,37,41,53,79,83,89,97,113,131,139,157,173,179,
%T 191,199,211,229,233,239,251,271,281,293,307,331,337,359,367,379,419,
%U 431,439,443,491,499,509,547,577,593,601,607,619,641,653,659,661,683
%N Primes such that their double is 1 away from a prime number.
%C This sequence is a variation of the sequence in the reference. However this sequence should have an infinite number of terms.
%D R. Crandall and C. Pomerance, Prime Numbers A Computational Perspective, Springer Verlag 2002, p. 49, exercise 1.18.
%H Harvey P. Dale, <a href="/A120628/b120628.txt">Table of n, a(n) for n = 1..1000</a>
%e 19 is a prime and 19*2 = 38 which is one away from 37 which is prime.
%e 13 is not in the table because 13*2 = 26 is one away from 25 and 27 both not prime.
%t Select[Range[683], PrimeQ[#] && Or[PrimeQ[2 # - 1], PrimeQ[2 # + 1]] &] (* _Ant King_, Dec 12 2010 *)
%t Select[Prime[Range[200]],AnyTrue[2#+{1,-1},PrimeQ]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Sep 26 2020 *)
%o (PARI) primepm2(n,k) { local(x,p1,p2,f1,f2,r); if(k%2,r=2,r=1); for(x=1,n, p1=prime(x); p2=prime(x+1); if(isprime(p1*k+r)||isprime(p1*k-r), print1(p1",") ) ) }
%Y Cf. A005382, A005384.
%K easy,nonn
%O 1,1
%A _Cino Hilliard_, Aug 17 2006