The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Products of Digits

Date: 03/02/2003 at 18:24:08
From: Liz
Subject: Product of digits

The product of digits in the number 234 is 24: 2*3*4 = 24.

Can you describe a general procedure for figuring out how many x-digit 
numbers have a product equal to p, where x and p are counting numbers?

How many different three-digit numbers have a product equal to 12? to 
18? Why does it work out that way?

Date: 03/03/2003 at 12:06:15
From: Doctor Ian
Subject: Re: Product of digits

Hi Liz,

A 'general procedure' would be to start by finding the prime factors
of p.  For example, if p = 12, the prime factors are

  12 = 2 * 2 * 3

We can use each prime factor as a digit, so now we want to know how
many distinct ways we can arrange them. If we treat the 2's as
individuals (2 and 2'), we get

  22'3  232'  2'23  2'32   322'   32'2

But of course, they aren't distinguishable, so we end up with half as
many possibilities:

  223 232 322

Once we've identified the digits, we can use rules for computing
permutations to generate the number of possibilities without having to 
write them all down. See the Dr. Math FAQ: 

   Permutations and Combinations 

For example, in this case, we had three digits to work with, so the 
number of arrangements would be 

  n = 3! 

    = 3 * 2 * 1 

But two of the digits were the same, and those could be arranged in 

  n = 2!

    = 2 * 1

different ways.  So we end up with 

  n = 3! / 2!

    = 6 / 2

    = 3

distinct arrangements of digits.     

Now, this is a particularly simple case, because the number of prime
factors is the same as the number of digits. But consider what happens 
when p = 24.  Now the prime factors are

  24 = 2 * 2 * 2 * 3

and we can group these in a couple of different ways:

  2 * (2*2) * 3           digits 2, 4, 3

  2 * 2 * (2*3)           digits 2, 2, 6

So now we can proceed as before, except using (2,3,4) and (2,2,6) as
if they were prime factors.  

In general, any time you're dealing with prime factors, it's hard to
come up with simple formulas that you can use to directly compute
numbers of possibilities, because you so often get repeated prime
factors. But you can still use prime factors to explain what happens
in any particular case, as I've done here. 

Note that there aren't a lot of ways to _combine_ two or more prime
factors to get a single digit:

  2 * 2     = 4
  2 * 3     = 6
  2 * 2 * 2 = 8
  3 * 3     = 9

So if you get prime factors of 5 or 7, you can forget about trying to
combine them into other digits. 

And if you ever have a value of p that has a prime factor of more than
two digits (for example, p = 26 = 2 * 13), then the answer is easy: 
there is _no_ way to get the product of the digits to be equal to p.

(If you understand why that's the case, then you're well on your way
to mastering the idea of prime factoring.) 

Also, consider what happens if you're looking for 5-digit numbers 
whose products are 12. You only have three prime factors to work with, 
so you'll have to use 1 for the remaining digits. 

I hope this helps.  Write back if you'd like to talk more about this,
or anything else. 

- Doctor Ian, The Math Forum 
Associated Topics:
Middle School Factoring Numbers
Middle School Prime Numbers

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.