Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int minDivPrim(int n) {
- int r = 1;
- for (int d = 2; d <= n; d++) {
- if (n % d == 0) {
- int prim = 1;
- for (int i = 2; i * i <= d && prim; i++) {
- if (d % i == 0) {
- prim = 0;
- }
- }
- if (prim) {
- r *= d;
- }
- }
- }
- return r;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement