-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Changed directory. - Changed source file from bits/stdc++ to iostream and math.h
- Loading branch information
Showing
2 changed files
with
28 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include <iostream> | ||
#include <math.h> | ||
|
||
using namespace std; | ||
int main() | ||
{ | ||
long long int n = 800851475143; | ||
long long int max = INT_MIN; | ||
while (n % 2 == 0) | ||
{ | ||
max = 2; | ||
n = n / 2; | ||
} | ||
|
||
for (long long int i = 3; i <= sqrt(n); i = i + 2) // i will only iterate through odd values | ||
{ | ||
while (n % i == 0) | ||
{ | ||
max = i; | ||
n = n / i; | ||
} | ||
} | ||
if (n > 2) | ||
{ | ||
max = n; | ||
} | ||
cout << max << endl; | ||
} |
This file was deleted.
Oops, something went wrong.