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.

A212820 Balanced primes which are the average of two successive semiprimes.

This page as a plain text file.
%I A212820 #17 Mar 24 2017 04:41:26
%S A212820 5,53,173,211,1511,3307,3637,4457,4993,6863,11411,11731,11903,12653,
%T A212820 15907,18223,20107,20201,20347,20731,22051,23801,26041,35911,39113,
%U A212820 40493,46889,47303,51551,52529,60083,63559,69623,71011,75787,77081,78803,85049,91297
%N A212820 Balanced primes which are the average of two successive semiprimes.
%C A212820 Prime p which is the average of the previous prime and the following prime and is also the average of two successive semiprimes.
%H A212820 Alois P. Heinz, <a href="/A212820/b212820.txt">Table of n, a(n) for n = 1..1000</a>
%F A212820 { A212820 } = { A006562 } intersection { A103654 }.
%e A212820 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).
%p A212820 with(numtheory):
%p A212820 prevsp:= proc(n) local k; for k from n-1 by -1
%p A212820            while isprime(k) or bigomega(k)<>2 do od; k end:
%p A212820 nextsp:= proc(n) local k; for k from n+1
%p A212820            while isprime(k) or bigomega(k)<>2 do od; k end:
%p A212820 a:= proc(n) option remember; local p;
%p A212820       p:= `if`(n=1, 2, a(n-1));
%p A212820       do p:= nextprime(p);
%p A212820          if p=(prevprime(p)+nextprime(p))/2 and
%p A212820             p=(prevsp(p)+nextsp(p))/2 then break fi
%p A212820       od; p
%p A212820     end:
%p A212820 seq (a(n), n=1..40);  # _Alois P. Heinz_, Jun 03 2012
%t A212820 prevsp[n_] := Module[{k}, For[k = n-1, PrimeQ[k] || PrimeOmega[k] != 2, k--]; k];
%t A212820 nextsp[n_] := Module[{k}, For[k = n+1, PrimeQ[k] || PrimeOmega[k] != 2 , k++]; k];
%t A212820 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];
%t A212820 Table[a[n], {n, 1, 40}] (* _Jean-François Alcover_, Mar 24 2017, after _Alois P. Heinz_ *)
%Y A212820 Cf. A006562, A103654.
%K A212820 nonn
%O A212820 1,1
%A A212820 _Gerasimov Sergey_, May 28 2012