I am trying to solve a project euler problem just so I can get more experience. The problem states:
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
However unsigned long long or unsigned double isn't big enough to hold this number to do calculations on it.
I using Dev-C++ as my IDE. What can I do to work with this number?
@captdrizzle: what exactly is the problem you're experiencing? unsignedlonglong (and longlong for that matter) is big enough to store 600851475143 and to calculate its prime factors. Likely there's a problem with your algorithm.
I get the same error message with unsigned long long int. I was able to solve the euler problem by taking the number as input into a unsigned long long type instead of declaring it with "subject".
Problem aside, does anybody know what caused this? If I want to work with exceptionally large numbers in the future do I have to take them as user/file input?
ULL is a suffix that tells the compiler "interpret the number as an unsigned long long integer" instead of a normal, as it seemed to be (which apparently it was truncated before assigning it).