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

Pari/GP, 248 bytes

Takes an polynomial as input, using Pari/GP'sGP has a built-in for this.

It takes an polynomial typeas input, e.g., 1-2*x+x^2.

p->#Set(polrootsreal(p))polsturm

Try it online!Try it online!

Pari/GP, 24 bytes

Takes an polynomial as input, using Pari/GP's built-in polynomial type, e.g., 1-2*x+x^2.

p->#Set(polrootsreal(p))

Try it online!

Pari/GP, 8 bytes

Pari/GP has a built-in for this.

It takes an polynomial as input, e.g., 1-2*x+x^2.

polsturm

Try it online!

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

Pari/GP, 24 bytes

Takes an polynomial as input, using Pari/GP's built-in polynomial type, e.g., 1-2*x+x^2.

p->#Set(polrootsreal(p))

Try it online!