OFFSET
1,1
COMMENTS
The harmonic mean of N numbers p1,p2,..,pN is the number H whose reciprocal is the arithmetic mean of the reciprocals of p1,p2,..,pN; that is to say, 1/H = ((1/p1)+(1/p2)+..+(1/pN))/N.
So, for two quantities p1 and p2, their harmonic mean may be written as H=(2*p1*p2)/(p1+p2).
The harmonic mean (sometimes called the subcontrary mean) is one of several kinds of average. Typically, it is appropriate for situations when the average of rates is desired.
LINKS
Wikipedia, Harmonic Mean
EXAMPLE
The primes before and after the prime p=13 are p1=11 and p2=17. So, the harmonic mean of p1 and p2 is 2*11*17/(11+17)=13.35714285... whose integer part is p=13. Then p=13 belongs to the sequence.
The primes before and after the prime p=17 are p1=13 and p2=19. The harmonic mean of p1 and p2 is 2*13*19/(13+19)=15.4375, having 15 as its integer part. Therefore, as 15<>p, p=17 is not in the sequence.
MAPLE
A := {}: for n from 2 to 1000 do p1 := ithprime(n-1): p := ithprime(n): p2 := ithprime(n+1): if p = floor(2*p1*p2/(p1+p2)) then A := `union`(A, {p}) end if end do; A := A;
MATHEMATICA
t = {}; Do[p = Prime[n]; If[Floor[HarmonicMean[{Prime[n - 1], Prime[n + 1]}]] == p, AppendTo[t, p]], {n, 2, 200}]; t (* T. D. Noe, Sep 04 2012 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
César Eliud Lozada, Sep 01 2012
STATUS
approved