Let recursive_betti work mod p.