Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Denenberg/6a0ab87afc63382d6b1b3accce366808 to your computer and use it in GitHub Desktop.
Save Denenberg/6a0ab87afc63382d6b1b3accce366808 to your computer and use it in GitHub Desktop.
Here's a simple program that prints the product of the digits of M^N for all M and N in the given range:
# Here's a simple program that prints the product
# of the digits of M^N for all M and N in the given range:
def product_of_digits(n):
result = 1
while n > 0:
result *= n % 10
n //= 10
return result
for m in range(2, 10):
for n in range(2, 10):
print (m, n, product_of_digits(m**n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment