All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 9! (Posted on 2005-02-28)

Find nine single digit numbers (other than 1, 2, 3, ..., and 9) with a sum of 45 and a product of 9! (362,880).

For instance, 2, 2, 3, 4, 5, 6, 7, 8, 8 add up to 45, but their product is 645,120.

Try finding the answer without the use of a program.

 See The Solution Submitted by Erik O. Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 re: thoughts (OK, I tried, but...) (spoiler) | Comment 3 of 12 |
(In reply to thoughts by Charlie)

I tried, using the thoughts in my previous post, but heck, that was beating my head against the wall for a D2 problem.

CLS
FOR a = 1 TO 5
FOR b = a TO (45 - a) / 8
tb = a + b: pb = a * b
FOR c = b TO (45 - tb) / 7
tc = tb + c: pc = pb * c
FOR d = c TO (45 - tc) / 6
td = tc + d: pd = pc * d
FOR e = d TO (45 - td) / 5
te = td + e: pe = pd * e
FOR f = 9 - te TO (45 - te) / 4
IF f >= e THEN
tf = te + f: pf = pe * f
FOR g = 27 - tf TO (45 - tf) / 3
IF g >= f THEN
tg = tf + g: pg = pf * g
FOR h = 36 - tg TO (45 - tg) / 2
IF h >= g THEN
th = tg + h: ph = pg * h
i = 45 - th
IF i < 10 AND i >= h THEN
pi = ph * i
IF pi = 362880 THEN
PRINT a; b; c; d; e; f; g; h; i
END IF
END IF
END IF
NEXT h
END IF
NEXT g
END IF
NEXT f
NEXT e
NEXT d
NEXT c
NEXT b
NEXT a

finds

1  2  3  4  5  6  7  8  9
1  2  4  4  4  5  7  9  9

the first being 9! form and the second the desired set.

In terms of my previous thoughts, that involves, relative to the 9 factorial form:

1. splitting apart the 8 into 4 and 2; losing 2 from the total and adding one number

2. splitting 6 into 3 and 2; losing 1 more from the total and adding another number

3. combining the two new 2's into 4; reducing the number of numbers by 1

4. combining the two new 3's into 9; losing all the gained 3 from the total and reducing the number of numbers by 1

 Posted by Charlie on 2005-02-28 16:24:48
Please log in:
 Login: Password: Remember me: Sign up! | Forgot password

 Search: Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (5)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2018 by Animus Pactum Consulting. All rights reserved. Privacy Information