OFFSET
2,1
COMMENTS
Subsidiary sequences: (1) Sequence of primes for a given prime p such that (p+q)/2 is a prime iff q belongs to this sequence. For example, for p = 5 the sequence is 17, 29, 41, 53, 89,...
Note that actually a(n) > prime(n+1) in all cases - because there is no prime between prime(n) and prime(n+1). - Zak Seidov, Jul 24 2013.
For n>2, a(n)-prime(n) is a multiple of 12. - Zak Seidov, Oct 15 2015
[Proof: the sequence searches prime triples prime(n)<q<a(n) such that q-prime(n)=a(n)-q, so q is the arithmetic mean of prime(n) and a(n). Seidov's theorem means that q-prime(n) and a(n)-q are multiples of 6 and cannot be multiples of 2 or 4 or 8 or 10 or 14 or 16 or 20 etc. The absence of such prime constellations (p,p+g,p+2g) with g=2, 4, 8, 10, etc is a fact proved by considering the prime triples modulo 3. - R. J. Mathar, Oct 16 2015]
LINKS
T. D. Noe and Zak Seidov, Table of n, a(n) for n = 2..10000
MAPLE
A084704 := proc(n)
local p, a, q ;
p := ithprime(n) ;
a := nextprime(p) ;
while not isprime((a+p)/2) do
a := nextprime(a) ;
end do:
return a;
end proc: # R. J. Mathar, Oct 16 2015
MATHEMATICA
Table[p = q = Prime[n]; While[q = NextPrime[q]; ! PrimeQ[(p + q)/2]]; q, {n, 2, 100}] (* T. D. Noe, Apr 20 2011 *)
p=2; Table[p=NextPrime[p]; q=NextPrime[p, 2]; While[!PrimeQ[(p+q)/2], q=NextPrime[q]]; q, {99}] (* Zak Seidov, Jul 24 2013 *)
PROG
(PARI) a(n) = {q = prime(n); p = nextprime(q+1); while (!isprime((q+p)/2), p = nextprime(p+1)); p; } \\ Michel Marcus, Oct 15 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Jun 08 2003
EXTENSIONS
More terms from David Wasserman, Jan 03 2005
STATUS
approved