Advertisement
Josif_tepe

Untitled

Mar 22nd, 2024
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. #include <set>
  5. using namespace std;
  6. typedef long long ll;
  7.  
  8.  
  9.  
  10. int main() {
  11.     ll x, n;
  12.     cin >> x >> n;
  13.    
  14.     for(int i = 0; i < n; i++) {
  15.         ll koren = sqrt(x);
  16.         ll prv_delitel = 1;
  17.        
  18.         for(ll j = 2; j <= koren; j++) {
  19.             if(x % j == 0) {
  20.                 prv_delitel = x / j;
  21.                 break;
  22.             }
  23.         }
  24.        
  25.        
  26.         x += prv_delitel;
  27.        
  28.     }
  29.     cout << x << endl;
  30.    
  31.     return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement