%I M4011 #169 Oct 16 2024 21:24:33
%S 5,53,157,173,211,257,263,373,563,593,607,653,733,947,977,1103,1123,
%T 1187,1223,1367,1511,1747,1753,1907,2287,2417,2677,2903,2963,3307,
%U 3313,3637,3733,4013,4409,4457,4597,4657,4691,4993,5107,5113,5303,5387,5393
%N Balanced primes (of order one): primes which are the average of the previous prime and the following prime.
%C Subsequence of A075540. - _Franklin T. Adams-Watters_, Jan 11 2006
%C This subsequence of A125830 and of A162174 gives primes of level (1,1): More generally, the i-th prime p(i) is of level (1,k) if and only if it has level 1 in A117563 and 2 p(i) - p(i+1) = p(i-k). - _Rémi Eismann_, Feb 15 2007
%C Note the similarity between plots of A006562 and A013916. - _Bill McEachen_, Sep 07 2009
%C Balanced primes U strong primes = good primes. Or, A006562 U A051634 = A046869. - _Juri-Stepan Gerasimov_, Mar 01 2010
%C Primes prime(n) such that A001223(n-1) = A001223(n). - _Irina Gerasimova_, Jul 11 2013
%C Numbers m such that A346399(m) is odd and >= 3. - _Ya-Ping Lu_, Dec 26 2021 and May 07 2024
%C "Balanced" means that the next and preceding gap are of the same size, i.e., the second difference A036263 vanishes; so these are the primes whose indices are 1 more than indices of zeros in A036263, listed in A064113. - _M. F. Hasler_, Oct 15 2024
%D A. Murthy, Smarandache Notions Journal, Vol. 11 N. 1-2-3 Spring 2000.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%D David Wells, The Penguin Dictionary of Curious and Interesting Numbers (Rev. ed. 1997), p. 134.
%H T. D. Noe, <a href="/A006562/b006562.txt">Table of n, a(n) for n = 1..10000</a>
%H M. Abramowitz and I. A. Stegun, eds., <a href="http://www.convertit.com/Go/ConvertIt/Reference/AMS55.ASP">Handbook of Mathematical Functions</a>, National Bureau of Standards, Applied Math. Series 55, Tenth Printing, 1972, p. 870.
%H Ernest G. Hibbs, <a href="https://www.proquest.com/openview/4012f0286b785cd732c78eb0fc6fce80">Component Interactions of the Prime Numbers</a>, Ph. D. Thesis, Capitol Technology Univ. (2022), see p. 33.
%H Shubhankar Paul, <a href="https://www.erpublication.org/admin/vol_issue1/upload%20Image/IJETR011954.pdf">Ten Problems of Number Theory</a>, International Journal of Engineering and Technical Research (IJETR), ISSN: 2321-0869, Volume-1, Issue-9, November 2013.
%H Shubhankar Paul, <a href="http://erpublication.org/admin/vol_issue1/upload%20Image/IJETR012013.pdf">Legendre, Grimm, Balanced Prime, Prime triple, Polignac's conjecture, a problem and 17 tips with proof to solve problems on number theory</a>, International Journal of Engineering and Technical Research (IJETR), ISSN: 2321-0869, Volume-1, Issue-10, December 2013.
%F 2*p_n = p_(n-1) + p_(n+1).
%F Equals { p = prime(k) | A118534(k) = prime(k-1) }. - _Rémi Eismann_, Nov 30 2009
%F a(n) = A000040(A064113(n) + 1) = (A122535(n) + A181424(n)) / 2. - _Reinhard Zumkeller_, Jan 20 2012
%F a(n) = A122535(n) + A117217(n). - _Zak Seidov_, Feb 14 2013
%F Equals A145025 intersect A000040 = A145025 \ A024675. - _M. F. Hasler_, Jun 01 2013
%F Conjecture: Limit_{n->oo} n*(log(a(n)))^2 / a(n) = 1/2. - _Alain Rocchelli_, Mar 21 2024
%F Conjecture: The asymptotic limit of the average of a(n+1)-a(n) is equivalent to 2*(log(a(n)))^2. Otherwise formulated: 2 * Sum_{n=1..N} (log(a(n)))^2 ~ a(N). - _Alain Rocchelli_, Mar 23 2024
%e 5 belongs to the sequence because 5 = (3 + 7)/2. Likewise 53 = (47 + 59)/2.
%e 5 belongs to the sequence because it is a term, but not first or last, of the AP of consecutive primes (3, 5, 7).
%e 53 belongs to the sequence because it is a term, but not first or last, of the AP of consecutive primes (47, 53, 59).
%e 257 and 263 belong to the sequence because they are terms, but not first or last, of the AP of consecutive primes (251, 257, 263, 269).
%t Transpose[ Select[ Partition[ Prime[ Range[1000]], 3, 1], #[[2]] ==(#[[1]] + #[[3]])/2 &]][[2]]
%t p=Prime[Range[1000]]; p[[Flatten[1+Position[Differences[p, 2], 0]]]]
%t Prime[#]&/@SequencePosition[Differences[Prime[Range[800]]],{x_,x_}][[All,2]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Jan 31 2019 *)
%o (PARI) betwixtpr(n) = { local(c1,c2,x,y); for(x=2,n, c1=c2=0; for(y=prime(x-1)+1,prime(x)-1, if(!isprime(y),c1++); ); for(y=prime(x)+1,prime(x+1)-1, if(!isprime(y),c2++); ); if(c1==c2,print1(prime(x)",")) ) } \\ _Cino Hilliard_, Jan 25 2005
%o (PARI) forprime(p=1,999, p-precprime(n-1)==nextprime(p+1)-p && print1(p",")) \\ _M. F. Hasler_, Jun 01 2013
%o (PARI) is(n)=n-precprime(n-1)==nextprime(n+1)-n && isprime(n) \\ _Charles R Greathouse IV_, Apr 07 2016
%o (Haskell)
%o a006562 n = a006562_list !! (n-1)
%o a006562_list = filter ((== 1) . a010051) a075540_list
%o -- _Reinhard Zumkeller_, Jan 20 2012
%o (Haskell)
%o a006562 n = a006562_list !! (n-1)
%o a006562_list = h a000040_list where
%o h (p:qs@(q:r:ps)) = if 2 * q == (p + r) then q : h qs else h qs
%o -- _Reinhard Zumkeller_, May 09 2013
%o (Magma) [a: n in [1..1000] | IsPrime(a) where a is NthPrime(n)-NthPrime(n+1)+NthPrime(n+2)]; // _Vincenzo Librandi_, Jun 23 2016
%o (Python)
%o from sympy import nextprime; p, q, r = 2, 3, 5
%o while q < 6000:
%o if 2*q == p + r: print(q, end = ", ")
%o p, q, r = q, r, nextprime(r) # _Ya-Ping Lu_, Dec 23 2021
%Y Primes A000040 whose indices are 1 more than A064113, indices of zeros in A036263 (second differences of the primes).
%Y Cf. A082077, A082078, A082079, A096697, A096698, A096699, A096700, A096701, A096702, A096703, A096704, A096693, A051634, A051635, A054342, A117078, A117563, A125830, A117876, A125576, A046869, A173891, A173892, A173893, A006560, A075540.
%Y Cf. A225494 (multiplicative closure); complement of A178943 with respect to A000040.
%Y Cf. A055380, A051795, A081415, A096710 for other balanced prime sequences.
%K nonn,easy,nice
%O 1,1
%A _N. J. A. Sloane_ and _Robert G. Wilson v_
%E Reworded comment and added formula from R. Eismann. - _M. F. Hasler_, Nov 30 2009
%E Edited by _Daniel Forgues_, Jan 15 2011