Skip to main content
deleted 4 characters in body
Source Link
alephalpha
  • 50k
  • 7
  • 68
  • 182

Pari/GP, 4846 bytes

The generating function of the sequence is:

$$\frac{(n-1)x^n}{x^{n+1}-2x+1}-\frac{1}{x-1}$$

(n,m)->Vec(x^nn--/((x^nx-(2-1/x)*x+1/x^n)*n---1/(x-1)+O(x^m))

Try it online!Try it online!

Pari/GP, 48 bytes

The generating function of the sequence is:

$$\frac{(n-1)x^n}{x^{n+1}-2x+1}-\frac{1}{x-1}$$

(n,m)->Vec(x^n/((x^n-2)*x+1)*n---1/(x-1)+O(x^m))

Try it online!

Pari/GP, 46 bytes

The generating function of the sequence is:

$$\frac{(n-1)x^n}{x^{n+1}-2x+1}-\frac{1}{x-1}$$

(n,m)->Vec(n--/(x-(2-1/x)/x^n)-1/(x-1)+O(x^m))

Try it online!

Source Link
alephalpha
  • 50k
  • 7
  • 68
  • 182

Pari/GP, 48 bytes

The generating function of the sequence is:

$$\frac{(n-1)x^n}{x^{n+1}-2x+1}-\frac{1}{x-1}$$

(n,m)->Vec(x^n/((x^n-2)*x+1)*n---1/(x-1)+O(x^m))

Try it online!