Advertisement
Josif_tepe

Untitled

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