(1)设an=a1qn-1,用an和a1表示出a2•an-1根据韦达定理推知a1和an是方程x2-66x+128=0的两根,求得a1和an进而求得qn-1,把a1和an代入Sn=126,进而求得q,
(2)把q代入qn-1=32,求得n.
【解析】
(1)∵{an}成等比数列,∴a1•an=a2•an-1=128,
∵a1+an=66
∴a1、an是方程x2-66x+128=0的两个实数根,
解方程x2-66x+128=0,得:x1=2,x2=64;
又a1最小,∴a1=2,an=64;
又Sn=126,
∴由从而得:,即q=2;
(2)由an=a1qn-1得:2×2n-1=64,
∴n=6.