Minimize the value of N by applying the given operations | C ++ implementation of the above approach ; function to return the product of distinct prime factors of a number ; find distinct prime ; Driver code
#include <bits/stdc++.h> NEW_LINE #define ll  long long int NEW_LINE using namespace std ; ll minimum ( ll n ) { ll product = 1 ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { while ( n % i == 0 ) n = n / i ; product = product * i ; } } if ( n >= 2 ) product = product * n ; return product ; } int main ( ) { ll n = 20 ; cout << minimum ( n ) << endl ; return 0 ; }