OFFSET
1,1
LINKS
Muniru A Asiru, Table of n, a(n) for n = 1..200
Wikipedia, Balanced prime
MAPLE
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:
isA160920 := proc(p) isBalPr(p, 2) and isBalPr(p, 3) and isBalPr(p, 4) ; end proc:
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
MATHEMATICA
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
PROG
(GAP) P:=Filtered([1, 3..2*10^7+1], IsPrime);;
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
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Joseph Stephan Orlovsky, May 30 2009
STATUS
approved