Advertisement
Josif_tepe

Untitled

Feb 3rd, 2024
686
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     long long x;
  8.     cin >> x;
  9.     int n;
  10.     cin >> n;
  11.    
  12.     for(int i = 0; i < n; i++) {
  13.         long long najgolem_delitel = 1;
  14.         for(long long j = 2; j * j <= x; j++) {
  15.             if(x % j == 0) {
  16.                 najgolem_delitel = x / j;
  17.                 break;
  18.             }
  19.         }
  20.         x += najgolem_delitel;
  21.     }
  22.     cout << x << endl;
  23.  
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement