Roots and all: An economical algorithm