Skip to main content
1 of 14
Arnauld
  • 197.8k
  • 20
  • 179
  • 650

#JavaScript (ES7), 193 bytes

Returns \$(a_k,a_{k-1},...,a_1,a_0)\$.

Uses Cramer's rule to solve a system of linear equations based on a Vandermonde matrix.

v=>(m=v.map((_,y)=>v.map((_,x)=>y**(v.length+~x)))).map((_,i)=>(D=m=>+m||m.reduce((s,[v],i)=>s+(i&1?-v:v)*D(m.map(([,...r])=>r).filter(_=>i--)),0))(m.map((r,y)=>r.map((k,x)=>x-i?k:v[y])))/D(m))

Try it online!

Arnauld
  • 197.8k
  • 20
  • 179
  • 650