Improve factor() recipe and fix its tests (GH-100576)

1 file changed