In the equal ratio sequence {an}, a1 + an = 34, A2 * a (n-1) = 64, the first n terms and Sn = 62, find the number of terms n and the value of common ratio Q

In the equal ratio sequence {an}, a1 + an = 34, A2 * a (n-1) = 64, the first n terms and Sn = 62, find the number of terms n and the value of common ratio Q

a2*a(n-1)=a1*an=64
And a1 + an = 34
We can get A1 = 2, an = 32 or A1 = 32, an = 2
In the first case, Sn = A1 (1-Q ^ n) / (1-Q) = (a1-q * an) / (1-Q) = (2-32q) / (1-Q) = 62
We get q = 2
In this case, n = 5
The second one is q = 1 / 2, n = 5