I have put eight four-digit numbers together in a 4x4 grid, such that four can be read across and four downwards.
Four of my numbers are odd and four are even. I have one cubed number going across and one going down, and I have one fourth-power number going across and one going down. Two of the other numbers in the grid are squares.
Which two numbers in my grid are not perfect powers?
These are the 11 possible fittings of fourth powers and cubes:
2744 9 4 1296 4096 46 6 4 2401 2401 2401 2401 46
4 0 2 0 3375 9 5 05 5 0 1000 0 3 70 8000 05
0 9 6859 3 6 1296 1296 6859 99 4913 4913 9 0 4096
1296 1296 1 1 3 1 9261 1296 76 6 1 46 6 0 9261
Six of these have a zero in the left column or top row, leaving 5:
9 4 1296 46 6 4 46
2 0 3375 05 5 0 05
6859 3 6 1296 6859 4096
1296 1 1 9261 1296 9261
What's left is to place one perfect square vertically and one horizontally. I haven't been able to find such squares.
The program for the above:
CLS
DATA 1296,2401,4096,6561
FOR i = 1 TO 4: READ fourth$(i): NEXT
DIM cube$(12)
FOR i = 1 TO 12
cube$(i) = LTRIM$(STR$(INT((i + 9) ^ 3 + .5)))
NEXT
FOR foNo = 1 TO 3
FOR foNo2 = foNo + 1 TO 4
FOR fRow = 1 TO 4
FOR fCol = 1 TO 4
IF MID$(fourth$(foNo), fCol, 1) = MID$(fourth$(foNo2), fRow, 1) THEN
FOR cNo = 1 TO 12
FOR cNo2 = 1 TO 12
IF cNo2 <> cNo THEN
FOR cRow = 1 TO 4
IF cRow <> fRow THEN
FOR cCol = 1 TO 4
IF cCol <> fCol THEN
IF MID$(cube$(cNo), cCol, 1) = MID$(cube$(cNo2), cRow, 1) THEN
IF MID$(cube$(cNo), fCol, 1) = MID$(fourth$(foNo2), cRow, 1) THEN
IF MID$(fourth$(foNo), cCol, 1) = MID$(cube$(cNo2), fRow, 1) THEN
REDIM grid$(4, 4)
FOR i = 1 TO 4
FOR j = 1 TO 4
grid$(i, j) = " "
NEXT
NEXT
FOR i = 1 TO 4
grid$(fRow, i) = MID$(fourth$(foNo), i, 1)
grid$(i, fCol) = MID$(fourth$(foNo2), i, 1)
grid$(cRow, i) = MID$(cube$(cNo), i, 1)
grid$(i, cCol) = MID$(cube$(cNo2), i, 1)
NEXT
flag = 1
FOR i = 1 TO 4
IF grid$(1, i) = "0" OR grid$(i, 1) = "0" THEN flag = 0
NEXT
IF flag THEN
ct = ct + 1
FOR row = 1 TO 4
FOR col = 1 TO 4
LOCATE row + 1, ct * 6 + col - 4
PRINT grid$(row, col);
NEXT
NEXT
END IF
END IF
END IF
END IF
END IF
NEXT cCol
END IF
NEXT cRow
END IF
NEXT cNo2
NEXT cNo
END IF
NEXT fCol
NEXT fRow
NEXT foNo2
NEXT foNo
|
Posted by Charlie
on 2005-07-10 15:49:50 |