To decide whether a plane foliation has a rational first integral is an open problem. We provide an algorithm that, under certain conditions, decides about algebraic integrability of fixed genus which, in the affirmative case, computes a rational first integral. This algorithm uses the extension of the foliation to a Hirzebruch surface and the reduction of its dicritical singularities.

This is a joint work with Carlos Galindo and Francisco Monserrat.