How could I use this method to sum all the products whose multiplicand/multiplier/product identity is writable as a
1 through n pandigital (i.e. pandigital_product(4) and (6) should return 12 and 162)?
def is_pandigital(num):
n = len(str(num))
result = 0
while num > 0:
digit = num % 10
if digit == 0 or digit > n:
return False
result |= (1 << (digit - 1))
num //= 10
return result == (1 << n) - 1```