Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not if you use Horner's method. Evaluating a(x-p)(x-q) takes two additions and two multiplications. Evaluating ax^2 + bx + c with Horner's method as (ax + b)x + c takes two additions and two multiplications as well. Factoring a polynomial to save on evaluation is as inefficient and roundabout as factoring a pair of integers to help compute their greatest common divisor. You're replacing an easy problem with a much harder one.


That's a fair point. Perhaps my example was badly chosen!




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: