login

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”).

A212820
Balanced primes which are the average of two successive semiprimes.
2
5, 53, 173, 211, 1511, 3307, 3637, 4457, 4993, 6863, 11411, 11731, 11903, 12653, 15907, 18223, 20107, 20201, 20347, 20731, 22051, 23801, 26041, 35911, 39113, 40493, 46889, 47303, 51551, 52529, 60083, 63559, 69623, 71011, 75787, 77081, 78803, 85049, 91297
OFFSET
1,1
COMMENTS
Prime p which is the average of the previous prime and the following prime and is also the average of two successive semiprimes.
LINKS
FORMULA
{ A212820 } = { A006562 } intersection { A103654 }.
EXAMPLE
53 is in the sequence because it is the average of 47 and 59 (the two neighboring primes) and 51 and 55 (the two neighboring semiprimes).
MAPLE
with(numtheory):
prevsp:= proc(n) local k; for k from n-1 by -1
while isprime(k) or bigomega(k)<>2 do od; k end:
nextsp:= proc(n) local k; for k from n+1
while isprime(k) or bigomega(k)<>2 do od; k end:
a:= proc(n) option remember; local p;
p:= `if`(n=1, 2, a(n-1));
do p:= nextprime(p);
if p=(prevprime(p)+nextprime(p))/2 and
p=(prevsp(p)+nextsp(p))/2 then break fi
od; p
end:
seq (a(n), n=1..40); # Alois P. Heinz, Jun 03 2012
MATHEMATICA
prevsp[n_] := Module[{k}, For[k = n-1, PrimeQ[k] || PrimeOmega[k] != 2, k--]; k];
nextsp[n_] := Module[{k}, For[k = n+1, PrimeQ[k] || PrimeOmega[k] != 2 , k++]; k];
a[n_] := a[n] = Module[{p}, p = If[n==1, 2, a[n-1]]; While[True, p = NextPrime[p]; If[p == (NextPrime[p, -1] + NextPrime[p])/2 && p == (prevsp[p] + nextsp[p])/2, Break[]]]; p];
Table[a[n], {n, 1, 40}] (* Jean-François Alcover, Mar 24 2017, after Alois P. Heinz *)
CROSSREFS
Sequence in context: A094847 A001992 A139899 * A094849 A094852 A267543
KEYWORD
nonn
AUTHOR
Gerasimov Sergey, May 28 2012
STATUS
approved