Advertisement
Josif_tepe

Untitled

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