Category Archives: Problem of the Week

POW – Sequential Triad 24

Many people are familiar with the math game 24, but not many know about the sequential triad version. You must make each of the following sequences true by only inserting operators and without changing the order of the numbers:

0   1   2 = 24
1   2   3 = 24
2   3   4 = 24
3   4   5 = 24
4   5   6 = 24
5   6   7 = 24
6   7   8 = 24
7   8   9 = 24
8   9   0 = 24
9   0   1 = 24

You can use any of the following operators on the left-hand side of the equation, but the right-hand side of the equation must remain untouched:

  • Addition: +
  • Subtraction (and negation): +
  • Multiplication: ×
  • Division: /
  • Exponential: ^
  • Modulo: &
  • Absolute Value: abs(X)
  • Ceiling (round up): ceil(X)
  • Floor (round down): floor(X)
  • Square root: sqrt(X)
  • Factorial: X!
  • Parentheses: ( and )

Feel free to post your answers below or you can wait until the answers are posted next week. 8-)

POW – JavaScript Self Inequality

Assuming a normal JavaScript engine, what could you possibly pass into the following mystery() function that would not thrown an error?

function mystery(a) {
  if (a === a) {
    throw new Error('The first argument has self equality.');
  }
}

As is normal, this answer will be shown a week from when it was posted and will be linked to from here.The answer to this POW can now be found here.

POW Answer – Appending = Adding Squares

This post gives the answer to last week’s Problem of the Week.

First of all, I have to admit that this problem actually came from the Quicker Maths blog. This blog actually pulled the problem from IBM’s Ponder this section.

First of all, in order to write the equation algebraicly, we could express the relationship as follows:
x2 + y2 = x + y × 1000

Unfortunately, the difficulty with solving the problem with just pencil and paper is the fact that we have to solve for the variables when they are both integers. For this reason, let’s do it with a programming language such as Python:

arr = []
for x in range(1000, 10000):
    for y in range(x, 10000):
        sum = x * x + y * y
        if sum == x * 10000 + y:
            arr.append("x = {0}, y = {1} => {2}".format(x, y, sum))
        elif sum == y * 10000 + x:
            arr.append("x = {0}, y = {1} => {2}".format(y, x, sum))

print("x * x + y * y = x * 10000 + y where:")
print("\n".join(arr))

Using this code will result in the following being printed out:

x * x + y * y = x * 10000 + y where:
x = 9412, y = 2353 => 94122353

As you can see, this was the brute-force way of solving this problem, but sometimes the brute-force way is the fastest way to come to the correct answer. 8)