num_factors.py implemented