Minimize the value of N by applying the given operations | Java implementation of the above approach ; function to return the product of distinct prime factors of a number ; find distinct prime ; Driver code
import java . util . * ; class solution { static int minimum ( int n ) { int 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 ; } public static void main ( String arr [ ] ) { int n = 20 ; System . out . println ( minimum ( n ) ) ; } }