I made a program to find the factors of a number:
#include <iostream>
#include <cmath>
using namespace::std;
int main() {
long int n = 6008514751432;
int i = 1;
while (i <= n/2) {
if (n % i == 0)
cout << i << " ";
i++;
}
}
I am using xCode BTW It works fine with smaller numbers, like 2000 lets say, or even 200000. But, when I get up to 6008514751432, which is the number I need to know, it doesn't work, it just says the program is running and displays nothing! What is going on?
Update: When I run the program and wait about 2 minutes, it says:
Warning: the current language does not match this frame.
Current language: auto; currently c++
(gdb)
long ints andints occupy the same amount of memory, so they have the same integer range.