Last active
August 29, 2015 13:56
-
-
Save musoftware/8882897 to your computer and use it in GitHub Desktop.
Largest prime factor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <iostream> | |
using namespace std; | |
void main() | |
{ | |
long int factor = 600851475143; | |
for (long int divider = 2; divider < factor; divider++) | |
{ | |
(factor % divider == 0) ? factor /= divider, divider = 2 : NULL; | |
} | |
cout << factor << endl; | |
system("pause"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment