You culd just stop at integer / 2 since numbers that large will obviously not divide evenly into it. How about you try it first and see if you can figure it out?
@KarolyHorvath: ...ok, that's true, but you can always just assume that N is divisible by N. My point is that running the loop on values greater than (n / 2) + 1 is a waste of time.
integer / 2since numbers that large will obviously not divide evenly into it. How about you try it first and see if you can figure it out?integer(n / 2) + 1is a waste of time.