I need to find out the prime factors of over 300 billion. I have a function that is adding to the list of them...very slowly! It has been running for about an hour now and i think its got a fair distance to go still. Am i doing it completly wrong or is this expected?!
(Please no solutions for my code to give it away, but some subtle hints will be welcomed =])
Edit: Ok just for all of ur curiosity, im trying to find the largest prime factor of the number 600851475143. I dont mind the answer but no code!
Edit: Egotistical programmers please move on to the next.
RESULT!! Haha ok guys i finally did it after alot of prime number reading...
{
List<Int64> ListOfPrimeFactors = new List<Int64>();
Int64 Number = 600851475143;
Int64 DividingNumber = 2;
while (DividingNumber < Number / DividingNumber)
{
if (Number % DividingNumber == 0)
{
ListOfPrimeFactors.Add(DividingNumber);
Number = Number/DividingNumber;
}
else
DividingNumber++;
}
ListOfPrimeFactors.Add(Number);
listBox1.DataSource = ListOfPrimeFactors;
}