a1an=a2a(n-1)=128,又a1+an=66,a1、an是方程x²-66x+128=0的两根
(x-64)(x-2)=0
x=64或x=2
a1=64 an=2时,
Sn=a1(qⁿ-1)/(q-1)=(qan-a1)/(q-1)=126
(2q-64)/(q-1)=126
62q=31
q=1/2
an/a1=q^(n-1)=(1/2)^(n-1)=64/2=32=(1/2)^(-5)
n-1=-5 n=-4(n为正整数,舍去)
a1=2 an=64时,
Sn=a1(qⁿ-1)/(q-1)=(qan-a1)/(q-1)=126
(64q-2)/(q-1)=126
62q=124
q=2
an/a1=q^(n-1)=2^(n-1)=64/2=32=2^5
n-1=5 n=6
综上,得n=6 q=2