Added problem 3 sol. Updated factor function to use squfof method