The program you want to modify is smallestfactor.m. You can test this program directly, or via primeFactors.m.