- #1

- 103

- 0

**X**

^{(k+1)}-X^{(k-d)}-X^{(k-d-1)}-...-1What I have so far is

Code:

```
k = 5;
d = 3;
syms X;
i = 0;
while (k-(d+i) >= 0)
terms(i+1) = k-(d+i);
i = i+1;
end
for j=1:i
poly = X^(k+1);
poly = inline(poly - X^(terms(j)));
end
```

This code is the example where k = 5, d = 3. The first while loop generates the terms of the polynomial, the second is meant to generate the polynomial, but it is not working.

In this example, the desired polynomial is

**X**

^{6}-X^{2}-X-1What the code is producing is

**X**

^{6}-1Any ideas on what I can do to produce the correct polynomial?

Thanks in advance.