Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- long long X;
- cin >> X;
- int N;
- cin >> N;
- for (int i = 0; i < N; ++i) {
- long long najgolem = 1;
- long long koren=sqrt(X);
- for (int j = 2; j <=koren; ++j)
- {
- if (X % j == 0 and X/j!=X)
- {
- najgolem = X/j;
- break;
- }
- }
- X += najgolem;
- }
- cout << X << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement