It works, but the algorithm is overly complicated — I didn’t
know about Hirzebruch’s generating function when I wrote it. The
generating function is given succinctly in this note by Donu
; he’s implemented it in Sage
I’ve implemented it in Macaulay2
, if you prefer that.