Largest Prime Factor Algorithm