project euler doubt 3 help


i'm perplexing work by digest euler i'm dispute separator problem 03. i have an algorithm works smaller numbers, nonetheless problem 3 uses very, unequivocally infinite number.



problem 03:
the primary factors 13195 5, 7, 13 29.
what largest primary means array 600851475143?



here fortitude c# it's controlling i cruise tie an hour. i'm looking an answer since i indeed wish solve myself. especially only looking help.



    stationary vacant main(string[] args) {
const enlarged n = 600851475143;
//const enlarged n = 13195;
enlarged count, half, largestprime = 0;
bool isaprime;

half = n / 2;

(long i = half; i > 1 && largestprime == 0; i--) {
(n % i == 0) { // factors n
count = 1;
isaprime = true;
while (++count < i && isaprime) {
(i % count == 0) { // does means n have factor? (not prime)
isaprime = false;
}
}
(isaprime) {
largestprime = i;
}
}
}

console.writeline("the largest primary means " + largestprime.tostring() + ".");
console.readline();
}


Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members