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

Home > Numbers
Nostra culpa (Posted on 2010-09-03) Difficulty: 2 of 5
WE + ARE +VERY = SORRY
For what value(s) of Y there is only one solution?

No Solution Yet Submitted by Ady TZIDON    
Rating: 3.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Two Means | Comment 4 of 6 |
I have been "advised" that the program listing below tells me something that it doesn't.

The program merely determines a set of values which are consistent with the expression.  It does not attempt to determine uniqueness.  The 'error' in my comment, now rectified, was due to incorrectly interpreting the problem text.

Using pencil and paper I derived Y=3 or 4, as in the these algorithms:


   we        75
  are      625
 very    9523
sorry  10223

   we        75
  are      625
 very    9524
sorry  10224

To confirm that they were the only solutions I wrote a program which gave both of the above as well as those below:


   we        65
  are      735
 very    9532
sorry  10332

   we        65
  are      735
 very    9534
sorry  10334

   we        65
  are       735
 very    9538
sorry  10338


   we        75
  are       625
 very    9528
sorry  10228

 The program yields y = {2,3,4,8}  but when y=2 or y=3 there is only one result for each.

The program listing:

CLS
OPEN "sorry.txt" FOR OUTPUT AS #1

FOR w = 1 TO 9
        IF used(w) = 0 THEN
        used(w) = 1
FOR e = 0 TO 9
        IF used(e) = 0 THEN
        used(e) = 1
FOR a = 1 TO 9
        IF used(a) = 0 THEN
        used(a) = 1
FOR r = 0 TO 9
        IF used(r) = 0 THEN
        used(r) = 1
FOR v = 1 TO 9
        IF used(v) = 0 THEN
        used(v) = 1
FOR y = 0 TO 9
        IF used(y) = 0 THEN
        used(y) = 1
FOR s = 1 TO 9
        IF used(s) = 0 THEN
        used(s) = 1
FOR o = 0 TO 9
        IF used(o) = 0 THEN
        used(o) = 1

        we = w * 10 + e
        are = a * 100 + r * 10 + e
        very = v * 1000 + e * 100 + r * 10 + y
        sorry = s * 10000 + o * 1000 + r * 100 + r * 10 + y
        IF (sorry = we + are + very) THEN
        PRINT "   we    "; we
        PRINT "  are   "; are
        PRINT " very  "; very
        PRINT "sorry "; sorry
        PRINT
        PRINT #1, "   we    "; we
        PRINT #1, "  are   "; are
        PRINT #1, " very  "; very
        PRINT #1, "sorry "; sorry
        PRINT #1,
        END IF



used(o) = 0
END IF
NEXT

used(s) = 0
END IF
NEXT

used(y) = 0
END IF
NEXT

used(v) = 0
END IF
NEXT

used(r) = 0
END IF
NEXT

used(a) = 0
END IF
NEXT

used(e) = 0
END IF
NEXT

used(w) = 0
END IF
NEXT


CLOSE 1

Edited on September 13, 2010, 9:26 pm
  Posted by brianjn on 2010-09-04 05:34:25

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 (0)
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