Is This Number Square Possible?

A heterosquare contains positive consecutive integers starting from 1 such that the rows, columns, and diagonals all add to different values.

Is it possible to make a heterosquare such that that the corners contain the digits 6, 7, 8, and 9?

This problem is part of the Brilliant.org Open Problems Group . The end goal for each open problem is to find a solution, and maybe publish it if it's a nice enough result! Even if we don't make it all the way there, we can have fun exploring unsolved problems and doing real research. This problem is related to an unsolved open problem, which you can read about here .

Yes No

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

I wrote a program that tests all possible squares that have the digits 6, 7, 8, and 9 in the corners. The program never writes the word 'True', so none of the possible squares are heterosquares.

import itertools

def isHeterosquare(square):
    # Input: a list of lists that represents a 3x3 square
    # Output: true if the square is a heterosquare. False otherwise
    sums = []
    #Rows
    sums.append(square[0][0] + square[0][1] + square[0][2])
    sums.append(square[1][0] + square[1][1] + square[1][2])
    sums.append(square[2][0] + square[2][1] + square[2][2])
    #Columns
    sums.append(square[0][0] + square[1][0] + square[2][0])
    sums.append(square[0][1] + square[1][1] + square[2][1])
    sums.append(square[0][2] + square[1][2] + square[2][2])
    #Diagonals
    sums.append(square[0][0] + square[1][1] + square[2][2])
    sums.append(square[0][2] + square[1][1] + square[2][0])

    # Figure out if all of the sums are unique
    if len(set(sums)) == 8:
        return True
    else:
        return False

#Create a list with all of the possible ways to order the numbers 1 to 5
oneToFive = list(itertools.permutations([1,2,3,4,5]))

#There are 4! = 24 ways of putting the numbers 6 through 9 on the corners. But after taking out the reflections and rotations, there are only 3 left
cases = []
cases.append([[6, 0, 7], [0, 0, 0], [8, 0, 9]])
cases.append([[6, 0, 7], [0, 0, 0], [9, 0, 8]])
cases.append([[6, 0, 8], [0, 0, 0], [9, 0, 7]])

#Combine every order of the numbers 1 to 5 with a case
for order in oneToFive:
    for case in cases:
        square = case
        square[0][1] = order[0]
        square[1][0] = order[1]
        square[1][1] = order[2]
        square[1][2] = order[3]
        square[2][1] = order[4]
        if (isHeterosquare(square)):
            print("True")
            break

print("Done")

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...