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

Home > Logic
Number Pyramid (Posted on 2004-08-20) Difficulty: 2 of 5
A "Number Pyramid" is composed of ten different numbers ( usually 0 - 9 ) with four rows. ONE EXAMPLE of a Number Pyramid is as follows:

      0

    1   2

  3  4   5

6  7   8   9

Given the clues below, determine the composition of a new Number Pyramid.

1) The sum of the two numbers in the second row is 11.

2) The sum of the numbers in the bottom row minus the sum of the numbers in the third row equals 10.

3) The rightmost numbers in the four rows must sum to 18.

4) The middle number in the third row minus the leftmost number in the second row should equal 4.

5) Subtracting the top number in the Pyramid from the rightmost number in the second row leaves 4.

6) In the bottom row, the leftmost number is greater than the second number from the left, while the rightmost number is greater than the second number from the right.

For bonus marks, which of the above clues (if any), are not necessary in order to construct the pyramid?

See The Solution Submitted by Jane Doe    
Rating: 3.5556 (9 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 24
   4
  3 8
 2 7 1
9 6 0 5

All the clues are necessary, as each of the following examples meets all the criteria except one. The first fails only the first clue, as 3+9 is not equal to 11. The second fails as 7+4+0+1-8-6-3 is not equal to 10.  The third fails because 4+8+1+6 = 19 rather than 18. The fourth fails as the subtraction gives -2 rather than 4. The fifth fails because that subtraction gives 1 rather than 4. The sixth fails because the first part of rule 6 is violated and the seventh fails because the second part of rule 6 is violated.  In each case all the other rules are met.

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

The program follows (formatting output into triangles was done manually):

DECLARE SUB permute (a$)
CLS
a$ = "0123456789": h$ = a$
DO
  a = VAL(MID$(a$, 1, 1))
  b = VAL(MID$(a$, 2, 1))
  c = VAL(MID$(a$, 3, 1))
  d = VAL(MID$(a$, 4, 1))
  e = VAL(MID$(a$, 5, 1))
  f = VAL(MID$(a$, 6, 1))
  g = VAL(MID$(a$, 7, 1))
  h = VAL(MID$(a$, 8, 1))
  i = VAL(MID$(a$, 9, 1))
  j = VAL(MID$(a$, 10, 1))
  ct = 0
  IF b + c = 11 THEN
   ct = ct + 1: t1 = 1
  ELSE
   t1 = 0
  END IF
  IF g + h + i + j - d - e - f = 10 THEN
   ct = ct + 1: t2 = 1
  ELSE
   t2 = 0
  END IF
  IF a + c + f + j = 18 THEN
   ct = ct + 1: t3 = 1
  ELSE
   t3 = 0
  END IF
  IF e - b = 4 THEN
   ct = ct + 1: t4 = 1
  ELSE
   t4 = 0
  END IF
  IF c - a = 4 THEN
   ct = ct + 1: t5 = 1
  ELSE
   t5 = 0
  END IF
  IF g > h THEN
   ct = ct + 1: t6 = 1
  ELSE
   t6 = 0
  END IF
  IF j > i THEN
   ct = ct + 1: t7 = 1
  ELSE
   t7 = 0
  END IF
  IF ct = 7 THEN
   PRINT a$
  ELSEIF ct = 6 THEN
   IF t1 = 0 THEN ess(1) = 1: ess1$ = a$
   IF t2 = 0 THEN ess(2) = 1: ess2$ = a$
   IF t3 = 0 THEN ess(3) = 1: ess3$ = a$
   IF t4 = 0 THEN ess(4) = 1: ess4$ = a$
   IF t5 = 0 THEN ess(5) = 1: ess5$ = a$
   IF t6 = 0 THEN ess(6) = 1: ess6$ = a$
   IF t7 = 0 THEN ess(7) = 1: ess7$ = a$
  END IF
  pperm$ = a$
  permute a$
  IF LEFT$(a$, 1) <> LEFT$(pperm$, 1) THEN PRINT "   "; a$ ' just to track progress
LOOP UNTIL a$ = h$
FOR i = 1 TO 7
 PRINT ess(i);
NEXT
PRINT
PRINT ess1$
PRINT ess2$
PRINT ess3$
PRINT ess4$
PRINT ess5$
PRINT ess6$
PRINT ess7$

 


  Posted by Charlie on 2004-08-20 09:50:22
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


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

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