#πŸ”’ Summing all products whose multiplicand/multiplier/product identity is writable as 1-n pandigital

4 messages Β· Page 1 of 1 (latest)

upbeat depot
#

How can I complete the pandigital_products() method so that it sums all the products whose multiplicand/multiplier/product identity is writable as a
1 through n pandigital? pandigitalProducts(4) and pandigitalProducts(6) should return 12 and 162.

def is_pandigital(n):
  mask = 0
  i = 0
  while n > 0:
      mask |= 1 << (n % 10)
      n //= 10
      i += 1
  return 2 + mask == 1 << (i + 1)

def pandigital_products(n):
    pass```
late sluiceBOT
#

@upbeat depot

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

late sluiceBOT
#

@upbeat depot

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.