Smallest N digit number divisible by all possible prime digits | Java implementation of the above approach ; Function to find the minimum number of n digits divisible by all prime digits ; Driver code
class GFG { static void minNum ( int n ) { if ( n < 3 ) System . out . println ( - 1 ) ; else System . out . println ( 210 * ( ( int ) ( Math . pow ( 10 , n - 1 ) / 210 ) + 1 ) ) ; } public static void main ( String [ ] args ) { int n = 5 ; minNum ( n ) ; } }