Advertisement
Josif_tepe

Untitled

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