The Museum of HP Calculators

HP Forum Archive 20

[ Return to Index | Top of Index ]

An interesting challenge
Message #1 Posted by Don Shepherd on 19 Nov 2011, 2:30 a.m.

How many 9-digit numbers containing all the digits 1,2,3,4,5,6,7,8,9 are prime numbers?

Edited: 19 Nov 2011, 2:39 a.m.

      
Re: An interesting challenge -- spoiler?
Message #2 Posted by Tony Duell on 19 Nov 2011, 3:50 a.m.,
in response to message #1 by Don Shepherd

Off the top of my head... Zero.

The sum of 1..9 = 45, which is a multiple of 9. Therefore any 9 digit number formed from a permuation of those 9 digits is also a multiple of 9 and thus not prime.

            
Re: An interesting challenge -- spoiler?
Message #3 Posted by Don Shepherd on 19 Nov 2011, 7:05 a.m.,
in response to message #2 by Tony Duell

Yes, what I had in mind actually was divisibility by 3. What a great way to teach the divisibility by 3 rule, which students can never seem to remember.

Edited: 19 Nov 2011, 7:07 a.m.

                  
Re: An interesting challenge -- spoiler?
Message #4 Posted by Marcus von Cube, Germany on 19 Nov 2011, 8:09 a.m.,
in response to message #3 by Don Shepherd

Don, do you have an easy proof for this rule (there are two: one for 3 and one for 9 and a similar one for 11)?

                        
Re: An interesting challenge -- spoiler?
Message #5 Posted by Dieter on 19 Nov 2011, 8:38 a.m.,
in response to message #4 by Marcus von Cube, Germany

You will easily get the idea if you look at the example of a, say, four-digit number.
This number will consist of the four digits abcd. It can be divided by 9 if abcd mod 9 = 0.

A number abcd can be written as

    1000 a  +  100 b +  10 c  +  d
We now want to evaluate
   (1000 a   +  100 b   +  10 c   +  d) mod 9
=  (999a + a +  99b + b +  9c + c +  d) mod 9
Since 999, 99, 9 etc. are all integer multiples of 9, this simplifies to
   (a  +  b  +  c  +  d) mod 9
In other words: in order to test whether a number can be divided by 9, simply check the sum of its digits. So if the remainder of the digit sum divided by 9 is zero, the number itself can be divided by 9 as well. This also means: if the remainder is 3 or 6, i.e. it can be divided by 3, the number itself is divisible by 3.

In other words:
If the digit sum is divisible by 9 resp. 3, so is the number itself.

Example:

  n = 12345
  sum of digits = 15
15 is not divisible by 9, but the remainder (6) is. Or: 15 can be divided by 3. So 12345 is divisible by 3 as well.
BTW, you can also continue with the digit sum of 15 which is 6 and judge the divisibility from this result. ;-)

Dieter

Edited: 19 Nov 2011, 8:43 a.m.

                        
Re: An interesting challenge -- spoiler?
Message #6 Posted by Patrice on 19 Nov 2011, 9:11 a.m.,
in response to message #4 by Marcus von Cube, Germany

Search for 'divisibility' in Wikipedia

Patrice

                        
Re: An interesting challenge -- spoiler?
Message #7 Posted by Don Shepherd on 19 Nov 2011, 9:53 a.m.,
in response to message #4 by Marcus von Cube, Germany

Well, I don't have a proof, just the fact that every middle school math textbook I've seen that discusses factoring and divisibility lists the test for divisibility for selected numbers. I generally teach the easy ones: 2 (even number), 3 (sum of digits divisible by 3), 5 (ends in 0 or 5), and 10 (ends in 0). There are tests for divisibility for other numbers, as Wikipedia shows, but in middle school we usually limit it to those 4.

                              
Re: An interesting challenge -- spoiler?
Message #8 Posted by Marcus von Cube, Germany on 19 Nov 2011, 10:08 a.m.,
in response to message #7 by Don Shepherd

4 is easy: the last two digits (read as a two digit number) need to be divisible by 4.

There is another rule for 11: It deals with the pairwise digit sum. Example 121: The pairwise sum is 01 + 21 = 22. This is divisible by 11 and hence 121 is. The proof must be similar to what Dieter has shown.

                                    
Re: An interesting challenge -- spoiler?
Message #9 Posted by Dieter on 19 Nov 2011, 1:49 p.m.,
in response to message #8 by Marcus von Cube, Germany

Quote:
The proof must be similar to what Dieter has shown.
You bet. :-)

The method is based on the fact that 99, 9999, 999999 etc. are all divisible by 11 (which can be easily proven as well). The approach is basically the same as before. Here, the number consists of groups with two digits aa, bb, cc etc., so an eight-digit value can be written as aabbccdd.

   aabbccdd mod 11
=  (1000000 aa       + 10000 bb      + 100 cc      +  dd) mod 11
=  ( 999999 aa + aa  +  9999 bb + bb +  99 cc + cc +  dd) mod 11
Since 99, 9999, 999999 etc. are divisible by 11, this simplifies to
   (aa + bb + cc + dd) mod 11
q.e.d.

Dieter

                  
Re: An interesting challenge -- spoiler?
Message #10 Posted by Crawl on 19 Nov 2011, 2:17 p.m.,
in response to message #3 by Don Shepherd

I'd be stunned if this problem would make the rule easier to remember. It seems like the rule is pretty easy to remember as is.

Actually, it seems like an easier rule to help remember this (as well as the times tables for 9) is that 9 times any single digit number results in a number whose digits not only add to a multiple of 9, but 9 itself.

      
Re: An interesting challenge
Message #11 Posted by Oliver Unter Ecker on 19 Nov 2011, 5:04 a.m.,
in response to message #1 by Don Shepherd

I guess app calculators are out of competition.

RPL+:

\<< 123456789 permutate isPrime total \>>

EDIT: he who doesn't know math, needs a calculator...

Edited: 19 Nov 2011, 7:52 a.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall