%I #36 Aug 23 2024 22:03:50
%S 491,757,1787,3571,6337,6451,6991,7741,7907,8821,10141,10267,10657,
%T 12911,15299,16189,18223,18701,19801,19843,19853,19937,21961,22543,
%U 22739,22807,23893,23909,24767,25169,25391,26591,26641,26693,26713
%N Balanced primes of order four.
%C The arithmetic mean of 8 primes in its "neighborhood"; not to be confused with 'Quadruply balanced primes' (A096710).
%C A balanced prime of order four is not necessarily balanced (A006562) order one, or of order two (A082077), or of order three (A082078), etc.
%H Aaron Toponce, <a href="/A082079/b082079.txt">Table of n, a(n) for n = 1..1000</a>
%e p = 491 = (463 + 467 + 479 + 487 + 491 + 499 + 503 + 509 + 521)/9 = 4419/9.
%t Do[s3=Prime[n]+Prime[n+1]+Prime[n+2]; s5=Prime[n-1]+s3+Prime[n+3]; s7=Prime[n-2]+s5+Prime[n+4]; s9=Prime[n-3]+s7+Prime[n+5]; If[Equal[s9/9, Prime[n+1]], Print[Prime[n+1]]], {n, 4, 10000}]
%t (* Second program: *)
%t With[{k = 4}, Select[MapIndexed[{Prime[First@ #2 + k], #1} &, Mean /@ Partition[Prime@ Range[3000], 2 k + 1, 1]], SameQ @@ # &][[All, 1]]] (* _Michael De Vlieger_, Feb 15 2018 *)
%t Select[Partition[Prime[Range[3000]],9,1],Mean[#]==#[[5]]&][[;;,5]] (* _Harvey P. Dale_, Mar 09 2023 *)
%o (GAP) P:=Filtered([1..50000],IsPrime);;
%o a:=List(Filtered(List([0..3000],k->List([5..13],j->P[j-4+k])), i-> Sum(i)/9=i[5]),m->m[5]); # _Muniru A Asiru_, Feb 14 2018
%o (PARI) isok(p) = {if (isprime(p), k = primepi(p); if (k > 4, sum(i=k-4, k+4, prime(i)) == 9*p;););} \\ _Michel Marcus_, Mar 07 2018
%Y Cf. A006562, A082077, A082078, A096697, A096698, A096699, A096700, A096701, A096702, A096703, A096704.
%Y Cf. A096693, A082080, A081415, A051795, A006562.
%K nonn
%O 1,1
%A _Labos Elemer_, Apr 08 2003