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

Home > Logic
What is RIGHT? (Posted on 2007-02-17) Difficulty: 3 of 5
Each of the ten digits is represented by a different letter of the alphabet in the following:

ONE, FOUR and NINE are perfect squares. That's all true.

Of the following statements, more than one is true:

EIGHT is even.
EIGHT + 1 is a perfect square.
EIGHT + ONE is a perfect square.
EIGHT - 1 is a prime.
EIGHT - ONE is a prime.
EIGHT + 7 is the product of two primes.
EIGHTEEN is divisible by 3.
EIGHTEEN is divisible by THREE.
EIGHTEEN - 2 is a perfect square.

What is RIGHT?

  Submitted by Charlie    
Rating: 4.0000 (2 votes)
Solution: (Hide)
Only two of the optionally true statements are true: EIGHT is even and EIGHT - 1 is a prime.

ONE, FOUR and NINE are 361, 2304, 6561 respectively.
EIGHT and EIGHTEEN are 15798 and 15798116.
THREE is 89411.

... and RIGHT is 45798.

DECLARE SUB factor (num#, s$)
   DEFDBL A-Z
   CLS
   FOR t = 1 TO 9
   taken(t) = 1
     FOR o = 1 TO 9
     IF taken(o) = 0 THEN
     taken(o) = 1
       FOR f = 1 TO 9
       IF taken(f) = 0 THEN
       taken(f) = 1
     FOR n = 1 TO 9
     IF taken(n) = 0 THEN
     taken(n) = 1
       FOR e = 1 TO 9
       IF taken(e) = 0 THEN
       taken(e) = 1
           one = o * 100 + n * 10 + e
           sr = INT(SQR(one) + .5)
           IF sr * sr = one THEN
     FOR u = 0 TO 9
     IF taken(u) = 0 THEN
     taken(u) = 1
       FOR r = 0 TO 9
       IF taken(r) = 0 THEN
       taken(r) = 1
           four = f * 1000 + o * 100 + u * 10 + r
           sr = INT(SQR(four) + .5)
           IF sr * sr = four THEN
     FOR i = 0 TO 9
     IF taken(i) = 0 THEN
     taken(i) = 1
           nine = 1010 * n + 100 * i + e
           sr = INT(SQR(nine) + .5)
           IF sr * sr = nine THEN
       FOR g = 0 TO 9
       IF taken(g) = 0 THEN
       taken(g) = 1
         FOR h = 0 TO 9
         IF taken(h) = 0 THEN
           three = t * 10000 + h * 1000 + r * 100 + e * 11
           eight = e * 10000 + i * 1000 + g * 100 + h * 10 + t
           eighteen = eight * 1000 + 110 * e + n

           tCt = 0
           IF t MOD 2 = 0 THEN tCt = tCt + 1
           ep1 = eight + 1
           sr = INT(SQR(ep1) + .5)
           IF sr * sr = ep1 THEN tCt = tCt + 1
           ep1 = eight + one
           sr = INT(SQR(ep1) + .5)
           IF sr * sr = ep1 THEN tCt = tCt + 1
           em1 = eight - 1
           factor em1, s$
           s$ = LTRIM$(RTRIM$(s$))
           IF INSTR(s$, " ") = 0 THEN tCt = tCt + 1
           em1 = eight - one
           factor em1, s$
           s$ = LTRIM$(RTRIM$(s$))
           IF INSTR(s$, " ") = 0 THEN tCt = tCt + 1
           ep7 = eight + 7
           factor ep7, s$
           s$ = LTRIM$(RTRIM$(s$))
           ix = INSTR(s$, " ")
           IF ix THEN
             s$ = LTRIM$(MID$(s$, ix + 1))
             IF INSTR(s$, " ") = 0 THEN tCt = tCt + 1
           END IF
           IF eighteen MOD 3 = 0 THEN tCt = tCt + 1
           IF eighteen MOD three = 0 THEN tCt = tCt + 1
           em2 = eight - 2
           sr = INT(SQR(em2) + .5)
           IF sr * sr = em2 THEN tCt = tCt + 1
           IF tCt > 1 THEN
             PRINT tCt
             right = r * 10000 + i * 1000 + g * 100 + h * 10 + t
             PRINT one, four, nine
             PRINT eight, eighteen
             PRINT three
             PRINT right
             REM
           END IF

         END IF
         NEXT
       taken(g) = 0
       END IF
       NEXT g
           END IF ' nine is perfect square
     taken(i) = 0
     END IF
     NEXT i
           END IF  ' four is perfect square
       taken(r) = 0
       END IF
       NEXT
     taken(u) = 0
     END IF
     NEXT u
           END IF  ' one a perfect square
       taken(e) = 0
       END IF
       NEXT
     taken(n) = 0
     END IF
     NEXT
       taken(f) = 0
       END IF
       NEXT
     taken(o) = 0
     END IF
     NEXT
   taken(t) = 0
   NEXT

SUB factor (num, s$)
    s$ = "": n = ABS(num): IF n > 0 THEN limit = SQR(n):  ELSE limit = 0
    IF limit <> INT(limit) THEN limit = INT(limit + 1)
    dv = 2: GOSUB DivideIt
    dv = 3: GOSUB DivideIt
    dv = 5: GOSUB DivideIt
    dv = 7
    DO UNTIL dv > limit
      GOSUB DivideIt: dv = dv + 4 '11
      GOSUB DivideIt: dv = dv + 2 '13
      GOSUB DivideIt: dv = dv + 4 '17
      GOSUB DivideIt: dv = dv + 2 '19
      GOSUB DivideIt: dv = dv + 4 '23
      GOSUB DivideIt: dv = dv + 6 '29
      GOSUB DivideIt: dv = dv + 2 '31
      GOSUB DivideIt: dv = dv + 6 '37
    LOOP
    IF n > 1 THEN s$ = s$ + STR$(n)
    EXIT SUB

DivideIt:
    DO
     q = INT(n / dv)
     IF q * dv = n AND n > 0 THEN
       n = q
       s$ = s$ + STR$(dv)
       IF n > 0 THEN limit = SQR(n):  ELSE limit = 0
       IF limit <> INT(limit) THEN limit = INT(limit + 1)
      ELSE
       EXIT DO
     END IF
    LOOP
    RETURN
END SUB

From Enigma # 1425 by Susan Denham, New Scientist, 13 January 2007.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Some ThoughtsPuzzle ThoughtsK Sengupta2022-09-11 01:13:51
re(2): Solution - don't peekCharlie2007-02-18 12:00:20
Solutionre: Solution - don't peekDej Mar2007-02-17 22:44:16
SolutionSolution - don't peekA2007-02-17 16:11:58
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 (3)
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