由 --- 於 星期五 四月 11, 2003 11:23 pm
Px+Qy+Rz=A
When P,Q,R兩兩互質, N~round(A*(A-P-Q-R)/2PQR);相當準確喔
Ex:
A=343
P=9,Q=5,R=2
N=round(A*(A-P-Q-R)/2PQR)=623
實際解也=623組.
Ex:
A=500
P=11,Q=5,R=3
N=round(A*(A-P-Q-R)/2PQR)=729
實際解也=729組.
--------------------------------------------------------------------------------
More:
(1)
P1X1+P2X2+P3X3+...+PkXk=A
When P1,P2,P3,..Pk兩兩互質, N~round((A-(P1+P2+P3+...+Pk)/2)^(k-1))/(k-1)!/P1P2P3...Pk)
(2)
If you want a accurate solution but not an estimation, you need "generation functon" to deal with.
Ex:
A=343
P=8,Q=5,R=2
estimated N=round((A-(P+Q+R)/2)^2/2PQR)=703
實際解=714組.
let w=cos(2pi/5)+isin(2pi/5)
let u=cos(pi/4)+isin(pi/4)
generation functon F(x)=1/(1-x^2)(1-x^5)(1-x^8)
=1/(1-x)^3/(1+x)^2/(1-w)(1-ww)(1-www)(1-wwww)/(1+i)(1-i)(1-u)(1-iu)(1+u)(1+iu)
部分分式化...
=a/(1-x)+b/(1-x)^2+c/(1-x^3)+d/(1+x)+e/(1+x)^2+f/(1-w)+g/(1-ww)+h/(1-www)+i/
(1-wwww)+j/(1+i)+k/(1-i)+l/(1-u)+m/(1-iu)+n’/(1+u)+o/(1+iu)
then
N(n)=a+b*(n+1)+c*(n+1)(n+2)/2!+d*(-1)^n)+e*(-1)^n*(n+1)+f*w^n+g*w^2n+h*w^3n+
i*w^4n+j*(-i)^n+k*i^n+l*u^n+m*(iu)^n+n’*(-u)^n+o/(-iu)^n
n再用343代入
--------------------------------------------------------------------------------
so, N(n)的主項=a+b*(n+1)+c*(n+1)(n+2)/2!+d*(-1)^n)+e*(-1)^n*(n+1)
error <|f|+|g|+|h|+|i|+...+|o|
--------------------------------------------------------------------------------
we can find that the "main variation item" is (-1)^n * (n+1)*e
so we can calculate c only, as a correction.
c=1/(1-(-1))^3/(1-1+1-1+1)/(1+1)/(1+1)=1/32
then the estimation N=round((A-(8+5+2)/2)^2/2/2/5/8 +(-1)^(A-(8+5+2))*(A-(8+5+2)+1)/32)
For calculate A=343, n=A-P-Q-R=328
n+1=329
then the estimation N=round((A-(8+5+2)/2)^2/2/2/5/8 +(-1)^(A-(8+5+2))*(A-
(8+5+2)+1)/32)=714; error=0
-------------------
for calculate A=8888, P=6,Q=5,R=27
n=A-P-Q-R=8850
F(x)=1/(1-x)^3/(1+x)/(1+x+xx)^2/(1+x+xx+xxx+xxxx)/(1+x^3+x^6+…+x^24)
main N=(A-(6+5+27)/2)^2/2/6/5/27=48555.037
F(x)=a/(1-xww)^2+b/(1-wx)^2)+…
main variation=cos(pi/6+pi*2n/3)*(n+1)/6/27/cos(pi/6)
estmated N=round(mainN+main variation)=(round(48555.037+54.636)=54610
error=0
------------------
一班而言, 以 Nmain=(A-sigma(Pi)/2)^(k-1)/k!(P1P2…Pk)
加上generation function 算出main variation項, 就可以得到絕大多數誤差不超過1的公式了
--------------------------------------------------------------------------------
Game-over.
喵的Excel說:"看不懂的不要問.看的懂的也不要問."
喵說:"看的懂又看不懂的才可以問"
喵的IE說:"問也沒用"