Referring to Pascal's triangle, n=12
12: [4096, [1, 12, 66, 220, 495, 792, 924, 792, 495, 220, 66, 12, 1]]
The coefficient of the middle term is 924
The power of x is (6 - 6/3) = 4
The middle term is 924*x^4
The sequence of exponents starts with 12 and ends with -4, decreasing by 4/3 in each subsequent term.
-------- program to generate Pascal's Triangle
coefs = [1,1]
power = 1
sumcoefs = sum(coefs)
coefDict = {1: [sumcoefs,coefs]}
while sumcoefs < 4100:
power += 1
new = [1]
for ind, val in enumerate(coefs):
if ind == 0:
continue
else:
new.append(coefs[ind-1] + val)
new.append(1)
coefs = new
sumcoefs = sum(coefs)
coefDict[power] = [sumcoefs,coefs]
if sumcoefs == 4096:
print([sumcoefs,coefs])
|
Posted by Larry
on 2024-05-05 10:20:08 |