Since (1+x2)2=1+2x2+x4, we can multiply this by (1+x)n to find the needed coefficients.
(1+x)n=∑r=0n(rn)xr, so each term in the product arises from multiplying one term in (1+x2)2 by one term in this expansion.
Only the product of 1 from the first factor with (1n)x from the second contributes to the coefficient of x, giving (1n)=n.
For the coefficient of x2, the contributions come from 1⋅(2n)x2 and 2x2⋅(0n), which sum to (2n)+2=2n(n−1)+2.
To find the coefficient of x3, we combine 1⋅(3n)x3 with 2x2⋅(1n)x, yielding (3n)+2n=6n(n−1)(n−2)+2n.
Because three numbers a,b,c are in AP precisely when 2b=a+c, we set
2(2n(n−1)+2)=n+6n(n−1)(n−2)+2n
n3−9n2+26n−24=0
(n−2)(n2−7n+12)=0
(n−2)(n−3)(n−4)=0, giving n=2,3,4
sum is 2+3+4=9.