Does this halt? Assume all variables are arbitrary precision integers.
/* http://en.wikipedia.org/wiki/Perfect_number#Odd_perfect_numb... */
void searchForOddPerfectNumber() { int n = 1, sumOfFactors, factor; while (1) { sumOfFactors = 0; for (factor = 1; factor < n; factor++) if (n % factor == 0) sumOfFactors += factor; if (sumOfFactors == n) break; n += 2; sumOfFactors = 0; } }
Does this halt? Assume all variables are arbitrary precision integers.
/* http://en.wikipedia.org/wiki/Perfect_number#Odd_perfect_numb... */