Home > Factorials > Description

## Factorials

Given a positive integer n, create a sequence of integers with the following characteristics:

• The sequence begins with 1.
• The sequence ends with n! (that is, with n factorial).
• Each element of the sequence, other than the first, is derivable from two earlier elements through addition, subtraction or multiplication. The two earlier elements need not be distinct. Subtraction can be performed in either direction.

Such a sequence is called a straight line program (SLP) for n!. If it has k+1 elements, it is said to have k steps.

For example, the following is a 7-step SLP for 5!:

``` 1, 2, 3, 6, -5, -30, 150, 120 ```

As required, each of its elements (other than the first) can be derived from two earlier elements:

``` 2 = 1 + 1 3 = 1 + 2 6 = 3 + 3 -5 = 1 - 6 -30 = 6 × -5 150 = -5 × -30 120 = -30 + 150 ```

### The Contest

For each integer n from 13 through 37, submit (see How to Enter, below) an SLP for n! with as few steps as possible. There are thus 25 distinct problems for which you are asked to submit solutions.

You can submit more than one solution for the same problem, but if you do we count only your best solution. There is no penalty for submitting multiple solutions for the same problem.

See The Scoring System, below, to learn how we determine the winner.

### The Prizes

First prize is your choice of any item from Bathsheba Sculpture worth up to \$500. The following pages show representative items in this price range:

Second prize is your choice of any item from Bathsheba Sculpture worth up to \$100. The following pages show representative items in this price range:

Finally, there are five identical prizes for third place through seventh place: a Factorials T-Shirt from the Mental Floss Store. Those who would rather have something different from the Mental Floss Store and who beg with sufficient creativity will be permitted to select any item worth up to \$30.

### How to Enter

Just paste your sequences into the large box on the Submit page and click the Submit Entry button. Format your sequences as follows:

• An individual sequence consists of a comma-delimited list of integers.
• Submit multiple sequences (for different values of n) in a single entry by separating them with semicolons. Do not put a semicolon after your last sequence.
• Include spaces and line breaks anywhere you like (except within a number) to improve readability.

For example, to submit the sequence given in the example above you might enter: `1, 2, 3, 6, -5, -30, 150, 120`

Do not submit entries under more than one account. This is important. Do not submit entries under more than one account.

### The Scoring System

We give a raw score to each solution you submit. The raw score is the number of steps in your sequence. For instance, if you were allowed to submit solutions for n = 5, the above example would receive a raw score of 7.

Each time you submit a solution we will merge it with your prior solutions, if any. The result will be a virtual entry containing your best solutions for each of the 25 problems. We will give each of these 25 solutions a subscore from 0 to 1 and their sum will be your contest score.

We calculate subscores for the individual solutions as follows. If your solution has the lowest raw score that was submitted for that problem, we give it 1 point; otherwise we give it only a fraction of a point. The fraction is the solution's raw score divided into the lowest raw score submitted by anyone for that same problem.

Let's walk through a simplified example. Suppose that we modify the contest by asking you to submit sequences for values of n from 4 through 6 -- that is, to submit SLPs for 4!, 5! and 6!.

Further suppose that we have 3 entrants (Ralphie, Farkus and Bo Ling) and that their best solutions have raw scores as follows:

4 factorial 5 factorial 6 factorial
Ralphie 7 10 13
Farkus 4 13 17
Bo Ling 6 8 18

We note the lowest raw score for each problem, as follows:

4 factorial 5 factorial 6 factorial
Lowest Raw Score 4 8 13

Finally, we compute the subscores and contest score for each entrant:

4 factorial 5 factorial 6 factorial Contest Score
Ralphie 4 / 7 = 0.5714 8 / 10 = 0.8000 13 / 13 = 1.0000 2.3714
Farkus 4 / 4 = 1.0000 8 / 13 = 0.6154 13 / 17 = 0.7647 2.3801
Bo Ling 4 / 6 = 0.6667 8 / 8 = 1.0000 13 / 18 = 0.7222 2.3889

If two entrants have the same contest score, we break the tie by giving preference to the entrant whose last improvement was submitted least recently.

First, check the FAQ section below. If you can't find the information you need there, send your question to the discussion group. If your question is of a personal nature, and not of general interest, send an email directly to Al Zimmermann.

### The Discussion Group

If you think you might enter the contest, you should join the contest discussion group. You can join either by sending a blank email here or by visiting the group on groups.io. The discussion group serves two purposes. First, it allows contestants to ask for clarifications to the rules. Be aware that sometimes these requests result in changes to the rules, and the first place those changes are announced is in the discussion group. Second, the discussion group allows contestants to interact with each other regarding programming techniques, results and anything else relevant to the contest.

### My Lawyer Would Want Me To Say This

I reserve the right to discontinue the contest at any time. I reserve the right to disqualify any entry or entrant for any reason that suits me. I reserve the right to interpret the rules as I see fit. I reserve the right to change the contest rules in mid-contest. In all matters contest-related, my word is final.

### Frequently Asked Questions

Can I enter the contest more than once, using different accounts?

No. Submitting entries from more than one account is not permitted.

Can teams enter the contest?

Collaboration is allowed. However, only one of the collaborators may register. If two contestants are found to have collaborated, even if this occurred before one or both registered, both will be disqualified.

What information about my solutions can I share in the discussion group?

There are two types of information that you are forbidden to post. The first is specific solutions. The second is code. You may post scores, so if you want to tell everyone that you got a raw score of 99 for n = 20 (whether true or not), go right ahead. Officially, you may also discuss the algorithms you are using but be aware that doing so annoys some people.

How can I find out what my individual subscores are?

You can't. I know this is frustrating, but it's a long standing policy that isn't going to change. Over the years it's been hotly debated in the discussion group and the contest administrator appears to have very strong feelings on the matter. You're going to have to learn to live with it. And I'd think twice before raising the issue yet again.

After I submit a solution, the scorer shows me the solution's "canonical representation". What is that?

After the scorer calculates your raw score it re-orders the elements of your sequence to create a standard representation. Having canonical representations makes it easier to notice when two seemingly different solutions are fundamentally the same.