Pandigital Product | Calculate the multiplicand , multiplier , and product eligible for pandigital ; To check the string formed from multiplicand multiplier and product is pandigital ; Driver code
def PandigitalProduct_1_9 ( n ) : NEW_LINE INDENT i = 1 NEW_LINE while i * i <= n : NEW_LINE INDENT if ( ( n % i == 0 ) and bool ( isPandigital ( str ( n ) + str ( i ) + str ( n // i ) ) ) ) : NEW_LINE INDENT return bool ( True ) NEW_LINE DEDENT i += 1 NEW_LINE DEDENT return bool ( False ) NEW_LINE DEDENT def isPandigital ( Str ) : NEW_LINE INDENT if ( len ( Str ) != 9 ) : NEW_LINE INDENT return bool ( False ) NEW_LINE DEDENT ch = " " . join ( sorted ( Str ) ) NEW_LINE if ( ch == "123456789" ) : NEW_LINE INDENT return bool ( True ) NEW_LINE DEDENT else : NEW_LINE INDENT return bool ( False ) NEW_LINE DEDENT DEDENT n = 6952 NEW_LINE if ( bool ( PandigitalProduct_1_9 ( n ) ) ) : NEW_LINE INDENT print ( " yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " no " ) NEW_LINE DEDENT