Untitled

mail@pastecode.io avatar
unknown
c_cpp
20 days ago
443 B
4
Indexable
Never
#include <iostream>
using namespace std;

int main() {
    long long n, x;
    cin >> x >> n;
    
    for(long long i = 0; i < n; i += 1) {

        long long najgolem_delitel = 1;

        for(long long j = 2; j * j <= x; j += 1) {
            if(x % j == 0) {
                najgolem_delitel = x / j;
                break;
            }
        }
        x += najgolem_delitel;
        
    }
    cout << x << endl;
    
    return 0;
}

Leave a Comment