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

Home > Numbers
Near Perfect (Posted on 2009-09-06) Difficulty: 3 of 5
In the following layout, each letter is to be replaced by a decimal digit. As there are more than ten letters, there's obviously repetition of digits.
A B C D E F G H I J K L

The digits can be considered as forming eight numbers, read left to right and top to bottom. Four have four digits each and four have two digits each.

Seven of these eight numbers are perfect squares. Only AB is not.

What are the digits to replace the letters?

  Submitted by Charlie    
No Rating
Solution: (Hide)
DECLARE SUB place (row#, col#)
CLEAR , , 25000


DEFDBL A-Z
DIM SHARED bd$(4, 4)

CLS

place 1, 2

END

SUB place (row, col)
 s = 4 * (row - 1) + col
 SELECT CASE s
  CASE 2, 3, 5, 8, 9, 14
   stVal = 1
  CASE ELSE
   stVal = 0
 END SELECT
 FOR n = stVal TO 9
   bd$(row, col) = LTRIM$(STR$(n))
   good = 1
   SELECT CASE s
    CASE 3, 8, 12, 15
     sq = VAL(bd$(row, 1) + bd$(row, 2) + bd$(row, 3) + bd$(row, 4))
     sr = INT(SQR(sq) + .5)
     IF sr * sr <> sq AND row > 1 THEN good = 0
     nxtRow = row + 1
     IF nxtRow < 4 THEN nxtCol = 1:  ELSE nxtCol = 2
    CASE ELSE
     nxtRow = row
     nxtCol = col + 1
   END SELECT
   IF good THEN
     SELECT CASE s
       CASE 9, 14, 15, 12
       sq = VAL(bd$(1, col) + bd$(2, col) + bd$(3, col) + bd$(4, col))
       sr = INT(SQR(sq) + .5)
       IF sr * sr <> sq THEN good = 0
     END SELECT
     IF good THEN
       IF nxtRow > 4 THEN
          FOR r = 1 TO 4
            FOR c = 1 TO 4
              PRINT RIGHT$(" " + bd$(r, c), 1);
            NEXT
            PRINT
          NEXT
          PRINT
       ELSE
          place nxtRow, nxtCol
       END IF
     END IF
   END IF
 NEXT n

END SUB

The above program does not verify that AB is not a square, and so produces:

 25
2116
5184
 64

 25
2916
5184
 64


 71
2304
5929
 64

Only in the last of the three is AB not a square.


Based upon Enigma No. 1555, "Not a square", by Richard England, New Scientist, 25 July 2009, page 26.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
computer solutionDaniel2009-09-06 23:03:43
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