Your task is to create many programs. The first outputs 1
, the second outputs 2
, etc. The higher you can go, the better!
However, all of these programs must be made the same list of characters. You can choose which characters to put in the list. Each program can only use a character as many times as it appears in the list.
For example, using the Python shell:
List of characters: +122
-------
Program 1: 1
Program 2: 2
Program 3: 1+2
Program 4: 2+2 (2 appears twice in the list)
It is impossible to make a program which prints 5
without reusing the +
character, so there are a total of 4
programs possible with this list. (Only consecutive numbers starting from 1 count. We therefore ignore other numbers we can make, like 12.)
Scoring
- Let N be the number of programs.
- Let S be the size of the shortest program, or 15, whichever is less.
- Let L be the length of the list.
Your score is N / Γ((L-S)/5), where Γ is the gamma function.
In the example above, N is 4; S is 1; L is 4; the score is 4 / Γ((4-1)/5) = 2.686.
Highest score wins!
Below is a Stack Snippet to help calculate your score:
var g=7,C=[0.99999999999980993,676.5203681218851,-1259.1392167224028,771.32342877765313,-176.61502916214059,12.507343278686905,-0.13857109526572012,9.9843695780195716e-6,1.5056327351493116e-7];function gamma(z) {if(z<0.5){return Math.PI/(Math.sin(Math.PI*z)*gamma(1-z));}else{z--;var x=C[0];for(var i=1;i<g+2;i++)x+=C[i]/(z+i);var t=z+g+0.5;return Math.sqrt(2*Math.PI)*Math.pow(t,(z+0.5))*Math.exp(-t)*x;}}function go(){var N=parseInt(jQuery('#programs').val()),S=parseInt(jQuery('#shortest').val()),L=parseInt(jQuery('#length').val());if(S>15){S=15;}jQuery('#score').val(N/gamma((L-S)/5));}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><form><table><tr><td><label>Number of programs:</label></td><td><input id='programs' oninput="go()" value='0'/></td></tr><tr><td><label>Size of shortest program:</label></td><td><input id='shortest' oninput="go()" value='0'/></td></tr><tr><td><label>Size of list:</label></td><td><input id='length' oninput="go()" value='0'/></td></tr><tr><td><label>Score:</label></td><td><output id='score'>0</output></td></tr></table></form><p>Code from <a href="http://stackoverflow.com/a/15454784/3148067">http://stackoverflow.com/a/15454784/3148067</a></p>
Rules
- You can use programs or functions.
- You may use different languages for different numbers.
- Each program must work by itself. For example, you can not assume that the first program will run before the second program.