Update main

changed the factor function to use modulus instead of labor intenive math functions