Count of multiplicative partitions of N | Java implementation to find the multiplicative partitions of the given number N ; Function to return number of ways of factoring N with all factors greater than 1 ; Variable to store number of ways of factoring n with all factors greater than 1 ; Driver Code ; 2 is the minimum factor of number other than 1. So calling recursive function to find number of ways of factoring N with all factors greater than 1
class MultiPart { static int getDivisors ( int min , int n ) { int total = 0 ; for ( int i = min ; i < n ; ++ i ) if ( n % i == 0 && n / i >= i ) { ++ total ; if ( n / i > i ) total += getDivisors ( i , n / i ) ; } return total ; } public static void main ( String [ ] args ) { int n = 30 ; System . out . println ( 1 + getDivisors ( 2 , n ) ) ; } }