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

Home > Logic
My Wonky CalcuLESS (Posted on 2009-02-18) Difficulty: 3 of 5
I bought a new calculator at the Dollar Store and, sure enough, it’s defective. After some trial and error with it, I discovered that each digit in the display contained the same two pairs of elements (out of the seven elements labeled A to G below) that were somehow ‘cross-wired’. That is, if one element was called upon to illuminate, its partner would illuminate instead. If both were supposed to illuminate, neither would! For example, if A/D and B/F were the faulty pairs, the number 3 would simply display as F/G/C, as illustrated below.

A
F B
G
E C
D


Based on the illuminated elements for each digit given below, find the faulty pairs to then solve the following 3-digit by 2-digit multiplication:

C/DF/B/G/E/CG/E/C
XF/G/C/DF/G/E/C/D
F/E/C/DF/G/C/DF/G/E/C/DF/E/C/D


See The Solution Submitted by rod hines    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
problems with computer program | Comment 1 of 14

I've tried the program below, and have not found a result.  I've left some notes below the program regarding its function.

DATA abcdef, bc, abdeg, abcdg, bcfg
DATA acdfg, acdefg, abc, abcdefg, abcdfg

FOR i = 0 TO 9: READ proto$(i): NEXT

FOR bad1 = 1 TO 6
 badlet1$ = MID$("abcdefg", bad1, 1)
FOR bad2 = bad1 + 1 TO 7
 badlet2$ = MID$("abcdefg", bad2, 1)
FOR bad3 = 1 TO 6
 badlet3$ = MID$("abcdefg", bad3, 1)
FOR bad4 = bad3 + 1 TO 7
 badlet4$ = MID$("abcdefg", bad4, 1)

IF bad3 <> bad1 AND bad3 <> bad2 AND bad4 <> bad1 AND bad4 <> bad2 THEN

had1 = 0: had2 = 0: had3 = 0: had4 = 0: had5 = 0: had6 = 0: had7 = 0

FOR i = 0 TO 9
  dig$(i) = proto$(i)

  ix1 = INSTR(dig$(i), badlet1$)
  ix2 = INSTR(dig$(i), badlet2$)
  IF ix1 > 0 AND ix2 = 0 THEN
    MID$(dig$(i), ix1, 1) = badlet2$
  ELSEIF ix2 > 0 AND ix1 = 0 THEN
    MID$(dig$(i), ix2, 1) = badlet1$
  ELSEIF ix1 > 0 AND ix2 > 0 THEN
    IF ix1 > ix2 THEN SWAP ix1, ix2
    dig$(i) = LEFT$(dig$(i), ix1 - 1) + MID$(dig$(i), ix1 + 1, ix2 - ix1 - 1) + MID$(dig$(i), ix2 + 1)
  END IF

  ix1 = INSTR(dig$(i), badlet3$)
  ix2 = INSTR(dig$(i), badlet4$)
  IF ix1 > 0 AND ix2 = 0 THEN
    MID$(dig$(i), ix1, 1) = badlet4$
  ELSEIF ix2 > 0 AND ix1 = 0 THEN
    MID$(dig$(i), ix2, 1) = badlet3$
  ELSEIF ix1 > 0 AND ix2 > 0 THEN
    IF ix1 > ix2 THEN SWAP ix1, ix2
    dig$(i) = LEFT$(dig$(i), ix1 - 1) + MID$(dig$(i), ix1 + 1, ix2 - ix1 - 1) + MID$(dig$(i), ix2 + 1)
  END IF
 
  DO
   done = 1
   FOR j = 1 TO LEN(dig$(i)) - 1
     IF MID$(dig$(i), j, 1) > MID$(dig$(i), j + 1, 1) THEN
       done = 0
       h$ = MID$(dig$(i), j, 1)
       MID$(dig$(i), j, 1) = MID$(dig$(i), j + 1, 1)
       MID$(dig$(i), j + 1, 1) = h$
     END IF
   NEXT
  LOOP UNTIL done
NEXT


op1$ = SPACE$(3)
op2$ = SPACE$(2)
ans$ = SPACE$(4)

FOR i = 0 TO 9
  SELECT CASE dig$(i)
    CASE "cd"
    : MID$(op1$, 1, 1) = LTRIM$(STR$(i))
    had1 = 1
    CASE "bcefg": MID$(op1$, 2, 1) = LTRIM$(STR$(i))
    had2 = 1
    CASE "ceg": MID$(op1$, 3, 1) = LTRIM$(STR$(i))
    had3 = 1
    CASE "cdfg": MID$(op2$, 1, 1) = LTRIM$(STR$(i))
                 MID$(ans$, 2, 1) = LTRIM$(STR$(i))
    had4 = 1
    CASE "cdefg": MID$(op2$, 2, 1) = LTRIM$(STR$(i))
                  MID$(ans$, 3, 1) = LTRIM$(STR$(i))
    had5 = 1
    CASE "cdef": MID$(ans$, 1, 1) = LTRIM$(STR$(i))
                 MID$(ans$, 4, 1) = LTRIM$(STR$(i))
    had6 = 1
    CASE ""
    had7 = 1
     extChar$ = LTRIM$(STR$(i))
  END SELECT
NEXT
tothad = had1 + had2 + had3 + had4 + had5 + had6 + had7
IF tothad = maxhad THEN numbmax = numbmax + 1
IF tothad > maxhad THEN maxhad = tothad: numbmax = 1
IF tothad = 4 THEN
 PRINT badlet1$; badlet2$; badlet3$; badlet4$; ": "
  FOR i = 0 TO 9: PRINT dig$(i); " "; : NEXT: PRINT
   PRINT op1$: PRINT op2$: PRINT ans$
END IF

  IF INSTR(op1$, " ") = 0 AND INSTR(op2$, " ") = 0 AND INSTR(ans$, " ") = 0 THEN
    IF VAL(op1$) * VAL(op2$) = VAL(ans$) THEN
      PRINT op1$: PRINT op2$: PRINT ans$
    END IF
  END IF

END IF

NEXT
NEXT
NEXT
NEXT

These lines of the program:

DATA abcdef, bc, abdeg, abcdg, bcfg
DATA acdfg, acdefg, abc, abcdefg, abcdfg

lay out the normal elements for a given digit 0 - 9.  I've also tried varying the representation of 1 from bc to ef, and the representation of 6 from acdefg to cdefg, and the 9 from abcdfg to abcfg.

The program never even gets to the point of evaluating the multiplication via

IF VAL(op1$) * VAL(op2$) = VAL(ans$) THEN

as any given set of two pairs of crossed elements results in only at most four of the six needed display configurations being possible.  All are possible with some set of crossed wires, but not all together with the same set of crossed wires.

Possible bugs would be if I misstated the ordinary configuration of elements for a given digit or had a logic error somewhere.   I know that there is a bug that I haven't even had a chance to arrive at yet: If more than one possible digit leads to the same erroneous configuration, then the multiplication would need to test all the possibilities for the ambiguous configurations. But I can't even get a situation where all the observed configurations are even possible, making at least two digits unaccounted for at any given time.


  Posted by Charlie on 2009-02-18 16:48:11
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 (14)
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