SHARE
TWEET

Untitled

a guest Feb 27th, 2020 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void FRadical(int n, int &x, int &y)
  2. {
  3.     x = 1;
  4.     y = 1;
  5.     int d = 2, p;
  6.     while(n != 1) {
  7.         p = 0;
  8.         while(n%d == 0)
  9.             n/=d, p++;
  10.         if(p) {
  11.             if(p%2 == 0) {
  12.                 for(int k = 1; k <= p/2; k++) x*=d;
  13.             }
  14.             else {
  15.                 for(int k = 1; k <= (p-1)/2; k++) x*=d;
  16.                 y*=d;
  17.             }
  18.         }
  19.         d++;
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top