Log in

No account? Create an account

Previous Entry | Next Entry

Yesterday my daughter in the fifth grade got the following homework assignment "arrange the digits one through nine into a nine-digit prime number." (Note, since zero wasn't included, it's not really a pandigital number.)

So I asked her how she'd start. She started the way I'd want her to, by excluding the digits 2, 4, 5, 6, and 8 from the units place. And then...

...we got nuthin'.

What did the teacher want? Could we use the computer to test answers? Did the teacher teach some tricks I don't know about? Maybe.

After trying and failing to construct a few nine-digit nearly pandigital prime numbers, I finally gave into every programmer's temptation.

The brute-force tactic! Test them all! In Python, it looks like this:

import itertools

l = '123456789'
for p in itertools.permutations( l ):
    n = int( ''.join(p) )
    if isprime( n ): # find an implementation on the web
        print "Found it!", n

We ran it and... What the hey‽ There isn't any such prime‽ What kind of stunt is this teacher trying to pull?


( 4 comments — Leave a comment )
Jan. 12th, 2012 03:00 pm (UTC)

Did the teacher introduce a method or "trick" to the students beforehand . . . i.e. were the students exposed to any ideas that might encourage them to add all the digits up to see if they are divisible by anything?

The last two paragraphs explain (well, at least summarize) why you can't get a prime number out of these digits, and teaches a method.

My guess is that teaching the shortcut first will provide a foundation for understanding more complex factoring later.

If the teacher didn't teach this beforehand, and was trying to make a point through exhausting the kids . . . weak pedagogy, IMO!
Jan. 12th, 2012 10:23 pm (UTC)
teaching that sometimes no solution, no answer axists.
Jan. 25th, 2012 03:45 am (UTC)
yeah to teach to look for no solution...first and simplest rule I thought of was if digits add up to a multiple of 3 then number is divisible by 3.

45 is divisible by 3
Jan. 25th, 2012 05:13 am (UTC)
You remembered that rule? I didn't. And even if I did, I wouldn't have felt comfortable telling the kids to use a rule that we hadn't proven yet. (Although by now, I know the proof.)
( 4 comments — Leave a comment )