Pandigital Product | To check the string formed from multiplicand , multiplier and product is pandigital ; calculate the multiplicand , multiplier , and product eligible for pandigital ; Driver Code
< ? php function isPandigital ( $ str ) { if ( strlen ( $ str ) != 9 ) return false ; $ x = str_split ( $ str ) ; sort ( $ x ) ; $ x = implode ( $ x ) ; return strcmp ( $ x , "123456789" ) ; } function PandigitalProduct_1_9 ( $ n ) { for ( $ i = 1 ; $ i * $ i <= $ n ; $ i ++ ) if ( $ n % $ i == 0 && isPandigital ( strval ( $ n ) . strval ( $ i ) . strval ( ( int ) ( $ n / $ i ) ) ) ) return true ; return false ; } $ n = 6050 ; if ( PandigitalProduct_1_9 ( $ n ) ) echo " yes " ; else echo " no " ; ? >