```p``` is already used for prime numbers, which makes this a little confusing. Maybe just write ```return minimal_polynomial(...)```.