OFFSET
1,1
COMMENTS
This sequence is a variation of the sequence in the reference. However this sequence should have an infinite number of terms.
REFERENCES
R. Crandall and C. Pomerance, Prime Numbers A Computational Perspective, Springer Verlag 2002, p. 49, exercise 1.18.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
19 is a prime and 19*2 = 38 which is one away from 37 which is prime.
13 is not in the table because 13*2 = 26 is one away from 25 and 27 both not prime.
MATHEMATICA
Select[Range[683], PrimeQ[#] && Or[PrimeQ[2 # - 1], PrimeQ[2 # + 1]] &] (* Ant King, Dec 12 2010 *)
Select[Prime[Range[200]], AnyTrue[2#+{1, -1}, PrimeQ]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Sep 26 2020 *)
PROG
(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", ") ) ) }
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Cino Hilliard, Aug 17 2006
STATUS
approved