prime factors with do while