An interesting Jess Rules application and the correct answer.
There seem to be only four combinations to the second question, those listed by Jim and Jess. (Ah! That's a name crying out for a pre-schooler book like Janet and John. Note how the order is important- John and Janet and Jess and Jim won't sound right. It's a rhyming thing. I presume John and Jess have more rhyming potential tucked at the end. That's another for Tim Allen
)
To restate the second problem to make it easier to write a program.
Construct pyramids of n-numbers in sequence where the numbers in a position below two higher positions shows the difference between two numbers in the higher positions. The n-th number must be in the top row since it is not the difference between any two other numbers.
Try it out with n-th numbers of 3,6,10,15; the first two have 2 and 4 solutions respectively.
Lots of valid sequences for 10 which always fail on the last number- ?
But I finally got this : hurray!
I suspect for 15 you'd have to start the pyramid at 6 to release the smaller numbers into the pool.
regards
[ October 26, 2003: Message edited by: HS Thomas ]