Super | Java implementation to check if N is a super - d number ; Function to check if N is a super - d number ; Utility function ; Driver Code
class GFG { static boolean isSuperdNum ( int n ) { for ( int d = 2 ; d < 10 ; d ++ ) { String subString = newString ( d ) ; if ( String . valueOf ( ( d * Math . pow ( n , d ) ) ) . contains ( subString ) ) return true ; } return false ; } private static String newString ( int d ) { String ans = " " ; for ( int i = 0 ; i < d ; i ++ ) { ans += String . valueOf ( d ) ; } return ans ; } public static void main ( String [ ] args ) { int n = 261 ; if ( isSuperdNum ( n ) == true ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }