There is a mathematical card game known as Krypto. The rules are simple: Each card has a numeric value. Six cards are dealt face-up in the center of the table: One card is designated as the *objective* card. The object of the game is to combine the remaining five cards in any order using the basic four arithmetic functions so that the result equals the objective. A player who believes that he has found a solution, calls *Krypto!* and has thirty seconds to show the solution.

For example, if the objective is 6 and the other five cards are 1, 3, 7, 1, and 8, then you can achieve the result by using the expression 7 + 1 - (8 / (3 + 1)) = 6. Fractions and negative numbers are not allowed.

As a teenager, I wondered if I could write a computer program to solve Krypto hands, but I never got off the ground. Recently I discovered that, naturally, somebody else has already done it.

My brother went to the state tournament for this game, where we discovered that he played at a whole different level from everybody else. For you see, my brother could solve nearly any hand in thirty seconds or less. Therefore, his strategy was merely to call *Krypto!* as soon as the cards were dealt, and then spend the next thirty seconds solving the puzzle. Using this technique, he could run the table. The scoring system for the game is such that the reward for winning a hand is far greater than the penalty for losing one, so the strategy pays off well.

My brother didn't go the national tournament because we didn't want to pay for airfare and accommodations. I vaguely recall that the design flaw in the game was addressed at the national tournament by converting the head-to-head competition into a series of puzzles.

(While writing up this article, I discovered another Krypto tournament which redesigned the game to avoid this flaw.)

Sounds rather similar to the numbers game on the UK game show Countdown ( en.wikipedia.org/…/Countdown_(game_show) )

Main difference is in the ranges of numbers used – as well as digits, multiples of 25 up to 100 are added and the objective is a random 3 digit number

Wow that page has many games in UBASIC. :)

Oh, yes, you could also take n-th root and raise to power too. So 382 could become 3rd-root-of-8=2. and 238 could become 2^3=8. Mind you, order is still important.

This is another Windows implementation of Krypto: http://www.lanet.lv/…/p106.htm

Does anybody know what percentage of krypto hands are solvable?

The version of this that I know was 24: every card had four numbers, and you tried to put them together in the given way to get 24.

There were more advanced versions with double digits and stuff, and perhaps roots.

My at the time girlfriend (now wife) asked me to make a version of this game for her on her PC (her version is 24). I eventually wrote a version for Windows Phone 7 and Windows Phone 8. The paid version allows you to increase the range of numbers that are potentially used to reach 24. You can also enable real numbers, with a precision of a single digit. getting 4 numbers to equal 24 when they are 6.4, 3.1, 4.8, and 9.0 (probably not a valid number set for 24) is significantly harder.

Your brother's strategy is similar to what I perceived Ken Jennings' strategy to be at times during his initial Jeopardy streak. I could often detect (I claim) in his expression as he rang in, "I may not know this immediately, but I'll bet I can figure it out before my time runs out."

In high school we used to play an alternative variation of this game. Actually, I had never even heard of Krypto until now. Our version was this – whenever a car passed, we would take the digits from the license plate (in our country there are 1-4 digits) and, without changing their order, try to put in operations so that there would be an equivalence. So, for example 4253 would become 4*2=5+3.

Later we added some rules too. The allowed operations were ()+-*/! log() sqrt(). We didn't allow for abs() or to put a "-" sign unless there was an actual subtraction (so no negative numbers). In this way there were some nice operations that allowed to solve most licence plates. Namely, sqrt(9) = 3; 3! = 6; log(10) = 1; log(1) = 0; 0*X=0. Most license plate numbers can be thus reduced to a zero on either side of the equivalence sign.

We got so good that we could figure out any number in under 10 seconds – which often astounded other our friends who didn't do this on a regular basis. :)

Some years later one of my friends also wrote a computer program to try all combinations on all license plate numbers. Turned out that (predictably), 1 2 and 3 digit numbers are rarely solvable, while there are only a few 4-digit numbers (something between 10 and 20, I think) which are unsolvable. Naturally, if you remove ! log() and sqrt() it gets harder.

At school, we used to play a similar game. It was called bus tickets. (In a typical Russian bus, you buy a ticket shortly after boarding, and keep it for the whole duration of the trip. It has a 6-digit serial number printed on it.) The objective number was fixed to 100, parentheses and the usual four (five, if you count unary minus separately) arithmetic operators over rationals were allowed. (Concatenating the digits was explicitly disallowed.)

Tickets are classified into several major groups: (a) unsolvable; (b) having multiple non-equivalent solutions (e.g. a+b = -(-a-b) but this does not count as variation); (c) trivial (having a solution of the kinds 4*25, 5*20 or 10*10); and (d) all others (called interesting tickets). A metaproblem is to calculate the number of possible interesting tickets.

Ah, middle school math club! I hated playing Krypto against Rex. Between him and Michael Hwang, it was a fool's errand to sit at their table beyond seeing which one could yell Krypto first as the last card was dealt.

@Ray:

My understanding is to have any chance at winning Jeopardy, you almost *have* to do that.

Hmm, I looked at the numbers and thought: (8 + 3 + 1 + 1) – 7 = 13 – 7 = 6

I hate division ;)

@Peter: The linked rules page claims that about a thousand of the 3 million or so possible hands are unsolvable.

"Hmm, I looked at the numbers and thought: (8 + 3 + 1 + 1) – 7 = 13 – 7 = 6"

Similar, I got (1+3+1)+(8-7)=6. I tried a few other problems and solved those with purely addition and subtraction too, within 10 seconds each time.

I also remember thinking, as soon as I saw "has thirty seconds to show the solution", that there would have to be a really stiff penalty for being timed out. The revised rules seem quite sensible and deal with a few edge cases I'd thought up; I particularly like the 20-40 distinction, which removes the temptation to only give the solution at the last second.

Håkan Kjellerstrand has implemented lots of different puzzles using constraint programming techniques. For Krypto he did a simpler version that doesn't handle parentheses, but it still might be interesting: github.com/…/krypto.mzn