Denote
L=p2+p3+⋯+p1005p1+p3+p4+⋯+p1006p2+⋯+p1+p2+⋯+p1004p2009
We will use the Cauchy-Schwarz inequality in the form:
For every a1,a2,…,an∈R, b1,b2,…,bn∈R+ it holds
b1a12+b2a22+⋯+bnan2≥b1+b2+⋯+bn(a1+a2+⋯+an)2
with an equality iff
b1a1=b2a2=⋯=bnan.
Then
L=p1(p2+p3+⋯+p1005)p12+p2(p3+p4+⋯+p1006)p22+…+p2009(p1+p2+⋯+p1004)p20092
SO
L≥∑i=12009pi(pi+1+⋯+pi+1004)(p1+p2+⋯+p2009)2.
Notice that the denominator of the last fraction is ∑i,j:i<jpipj. Let
α=∑i=12009pi(pi+1+⋯+pi+1004)(p1+p2+⋯+p2009)2.
Then (∑pi)2=2α((∑pi)2−(∑pi2)), so we have
2α∑pi2=(2α−1)(∑pi)2i.e.α−2α(∑pi2)=(∑pi)2.
So 0<α−2α≤2009 (we get the second inequality from Cauchy-Schwarz or the inequality between the quadratic and arithmetic mean). This inequality is actually equivalent to α≥10042009. Thus, L≥10042009 and equality holds iff
p1=p2=⋯=p2009.