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.

A160920 Primes which are at the same time balanced primes of order 2, 3 and 4.

This page as a plain text file.
%I A160920 #22 Apr 15 2018 13:50:04
%S A160920 236429,1108477,1829801,2073263,2191513,2192789,3236267,3990031,
%T A160920 4248947,4485683,4986061,6869969,7711079,8473811,8480911,9282173,
%U A160920 9327277,9350123,9547303,9730649,12077909,12993917,13165441,13398611,14129761,14785907
%N A160920 Primes which are at the same time balanced primes of order 2, 3 and 4.
%C A160920 The intersection of A082077, A082078 and A082079.
%H A160920 Muniru A Asiru, <a href="/A160920/b160920.txt">Table of n, a(n) for n = 1..200</a>
%H A160920 Wikipedia, <a href="https://en.wikipedia.org/wiki/Balanced_prime">Balanced prime</a>
%p A160920 isBalPr := proc(p,o) local r,s,i ; r := p ; if isprime(p) then s := p ; for i from 1 to o do r := nextprime(r) ; s := s+r ; end do: r := p ; for i from 1 to o do r := prevprime(r) ; s := s+r ; end do: s := s/(2*o+1) ; if s = p then true; else false; end if; else false; end if; end proc:
%p A160920 isA160920 := proc(p) isBalPr(p,2) and isBalPr(p,3) and isBalPr(p,4) ; end proc:
%p A160920 for i from 10 do p := ithprime(i) ; if isA160920(p) then printf("%d,\n",p); end if; end do: # _R. J. Mathar_, Dec 15 2010
%t A160920 PrimeNext[n_]:=Module[{k},k=n+1;While[ !PrimeQ[k],k++ ];k];PrimePrev[n_]:=Module[{k},k=n-1;While[ !PrimeQ[k],k-- ];k];lst={};Do[p=Prime[n];a1=PrimePrev[p];a2=PrimePrev[a1];a3=PrimePrev[a2];a4=PrimePrev[a3];a5=PrimePrev[a4];b1=PrimeNext[p];b2=PrimeNext[b1];b3=PrimeNext[b2];b4=PrimeNext[b3];b5=PrimeNext[b4];If[(a1+a2+a3+a4+b1+b2+b3+b4)/8==p&&(a1+a2+a3+b1+b2+b3)/6==p&&(a1+a2+b1+b2)/4==p,AppendTo[lst,p]],{n,2*9!}];lst
%o A160920 (GAP) P:=Filtered([1,3..2*10^7+1],IsPrime);;
%o A160920 a:=Intersection(List([2,3,4],b->List(Filtered(List([0..Length(P)-(2*b+1)],k->List([1..2*b+1],j->P[j+k])),i->Sum(i)/(2*b+1)=i[b+1]),m->m[b+1]))); # _Muniru A Asiru_, Apr 08 2018
%Y A160920 Cf. A040040, A051795, A082077, A082078, A082079.
%K A160920 nonn
%O A160920 1,1
%A A160920 _Vladimir Joseph Stephan Orlovsky_, May 30 2009