The real treasure was the numbers we made along the way
$begingroup$
Your task is to write a program, function or snippet (yes, snippets are allowed) that simply outputs an integer. However, you must be able to separate your submission into prefixes that also produce distinct integers. You cannot use any bytes that have appeared in previous prefixes. For example, we can have the prefixes:
1 # 1 (Now we can't use 1)
1-6 # -5 (Now we can't use - or 6)
1-6/3 # -1 (Now we can't use / or 3)
1-6/2+0xA # 9 Final submission
Rules
- Your goal is to create to try and create the most unique integers, while keeping them close to zero.
- The scoring system is
((number of unique integers)**3)/(sum of absolute values)
, where the higher your score, the better. The above example scores $(4^3)/(1+lvert-5rvert+lvert-1rvert+9) = 64/16 = 4$.
- The scoring system is
- There should be at least two unique integers (no dividing by zero!)
- Please format your answer similar to:
# Language, $(4^{3})/16 = 4$
1-6/2+0xA (the full program)
- Mention if your submission is composed of snippets that evaluate to a value, functions or full programs.
- List each of the prefixes and (optionally) an explanation for how they work.
number code-challenge restricted-source
$endgroup$
|
show 7 more comments
$begingroup$
Your task is to write a program, function or snippet (yes, snippets are allowed) that simply outputs an integer. However, you must be able to separate your submission into prefixes that also produce distinct integers. You cannot use any bytes that have appeared in previous prefixes. For example, we can have the prefixes:
1 # 1 (Now we can't use 1)
1-6 # -5 (Now we can't use - or 6)
1-6/3 # -1 (Now we can't use / or 3)
1-6/2+0xA # 9 Final submission
Rules
- Your goal is to create to try and create the most unique integers, while keeping them close to zero.
- The scoring system is
((number of unique integers)**3)/(sum of absolute values)
, where the higher your score, the better. The above example scores $(4^3)/(1+lvert-5rvert+lvert-1rvert+9) = 64/16 = 4$.
- The scoring system is
- There should be at least two unique integers (no dividing by zero!)
- Please format your answer similar to:
# Language, $(4^{3})/16 = 4$
1-6/2+0xA (the full program)
- Mention if your submission is composed of snippets that evaluate to a value, functions or full programs.
- List each of the prefixes and (optionally) an explanation for how they work.
number code-challenge restricted-source
$endgroup$
$begingroup$
Any chance we could reuse whitespace characters?
$endgroup$
– Shaggy
3 hours ago
$begingroup$
Can we look at out own code cheating-quine style, like withopen(__file__)
in Python?
$endgroup$
– xnor
2 hours ago
$begingroup$
The Final submission line appears to have swapped the 3 for a 2 (I haven't edited to correct this in case I've misunderstood)
$endgroup$
– trichoplax
2 hours ago
$begingroup$
It looks to me like you can get a near-optimal score in Python by writingprint 123-len(open(__file__).read())
followed by#
then one of each byte not used so far (except some control characters), with prefixes chopping those bytes. Adjust 123 to whatever centers the range of outputs around 0. For a better score, the non-comment part of the program can be rewritten using only the 7 distinct characters that are universal for Python. Is this all valid?
$endgroup$
– xnor
2 hours ago
1
$begingroup$
@JoKing I do include negatives, when the difference is negative.
$endgroup$
– xnor
2 hours ago
|
show 7 more comments
$begingroup$
Your task is to write a program, function or snippet (yes, snippets are allowed) that simply outputs an integer. However, you must be able to separate your submission into prefixes that also produce distinct integers. You cannot use any bytes that have appeared in previous prefixes. For example, we can have the prefixes:
1 # 1 (Now we can't use 1)
1-6 # -5 (Now we can't use - or 6)
1-6/3 # -1 (Now we can't use / or 3)
1-6/2+0xA # 9 Final submission
Rules
- Your goal is to create to try and create the most unique integers, while keeping them close to zero.
- The scoring system is
((number of unique integers)**3)/(sum of absolute values)
, where the higher your score, the better. The above example scores $(4^3)/(1+lvert-5rvert+lvert-1rvert+9) = 64/16 = 4$.
- The scoring system is
- There should be at least two unique integers (no dividing by zero!)
- Please format your answer similar to:
# Language, $(4^{3})/16 = 4$
1-6/2+0xA (the full program)
- Mention if your submission is composed of snippets that evaluate to a value, functions or full programs.
- List each of the prefixes and (optionally) an explanation for how they work.
number code-challenge restricted-source
$endgroup$
Your task is to write a program, function or snippet (yes, snippets are allowed) that simply outputs an integer. However, you must be able to separate your submission into prefixes that also produce distinct integers. You cannot use any bytes that have appeared in previous prefixes. For example, we can have the prefixes:
1 # 1 (Now we can't use 1)
1-6 # -5 (Now we can't use - or 6)
1-6/3 # -1 (Now we can't use / or 3)
1-6/2+0xA # 9 Final submission
Rules
- Your goal is to create to try and create the most unique integers, while keeping them close to zero.
- The scoring system is
((number of unique integers)**3)/(sum of absolute values)
, where the higher your score, the better. The above example scores $(4^3)/(1+lvert-5rvert+lvert-1rvert+9) = 64/16 = 4$.
- The scoring system is
- There should be at least two unique integers (no dividing by zero!)
- Please format your answer similar to:
# Language, $(4^{3})/16 = 4$
1-6/2+0xA (the full program)
- Mention if your submission is composed of snippets that evaluate to a value, functions or full programs.
- List each of the prefixes and (optionally) an explanation for how they work.
number code-challenge restricted-source
number code-challenge restricted-source
asked 3 hours ago
Jo KingJo King
22.3k251115
22.3k251115
$begingroup$
Any chance we could reuse whitespace characters?
$endgroup$
– Shaggy
3 hours ago
$begingroup$
Can we look at out own code cheating-quine style, like withopen(__file__)
in Python?
$endgroup$
– xnor
2 hours ago
$begingroup$
The Final submission line appears to have swapped the 3 for a 2 (I haven't edited to correct this in case I've misunderstood)
$endgroup$
– trichoplax
2 hours ago
$begingroup$
It looks to me like you can get a near-optimal score in Python by writingprint 123-len(open(__file__).read())
followed by#
then one of each byte not used so far (except some control characters), with prefixes chopping those bytes. Adjust 123 to whatever centers the range of outputs around 0. For a better score, the non-comment part of the program can be rewritten using only the 7 distinct characters that are universal for Python. Is this all valid?
$endgroup$
– xnor
2 hours ago
1
$begingroup$
@JoKing I do include negatives, when the difference is negative.
$endgroup$
– xnor
2 hours ago
|
show 7 more comments
$begingroup$
Any chance we could reuse whitespace characters?
$endgroup$
– Shaggy
3 hours ago
$begingroup$
Can we look at out own code cheating-quine style, like withopen(__file__)
in Python?
$endgroup$
– xnor
2 hours ago
$begingroup$
The Final submission line appears to have swapped the 3 for a 2 (I haven't edited to correct this in case I've misunderstood)
$endgroup$
– trichoplax
2 hours ago
$begingroup$
It looks to me like you can get a near-optimal score in Python by writingprint 123-len(open(__file__).read())
followed by#
then one of each byte not used so far (except some control characters), with prefixes chopping those bytes. Adjust 123 to whatever centers the range of outputs around 0. For a better score, the non-comment part of the program can be rewritten using only the 7 distinct characters that are universal for Python. Is this all valid?
$endgroup$
– xnor
2 hours ago
1
$begingroup$
@JoKing I do include negatives, when the difference is negative.
$endgroup$
– xnor
2 hours ago
$begingroup$
Any chance we could reuse whitespace characters?
$endgroup$
– Shaggy
3 hours ago
$begingroup$
Any chance we could reuse whitespace characters?
$endgroup$
– Shaggy
3 hours ago
$begingroup$
Can we look at out own code cheating-quine style, like with
open(__file__)
in Python?$endgroup$
– xnor
2 hours ago
$begingroup$
Can we look at out own code cheating-quine style, like with
open(__file__)
in Python?$endgroup$
– xnor
2 hours ago
$begingroup$
The Final submission line appears to have swapped the 3 for a 2 (I haven't edited to correct this in case I've misunderstood)
$endgroup$
– trichoplax
2 hours ago
$begingroup$
The Final submission line appears to have swapped the 3 for a 2 (I haven't edited to correct this in case I've misunderstood)
$endgroup$
– trichoplax
2 hours ago
$begingroup$
It looks to me like you can get a near-optimal score in Python by writing
print 123-len(open(__file__).read())
followed by #
then one of each byte not used so far (except some control characters), with prefixes chopping those bytes. Adjust 123 to whatever centers the range of outputs around 0. For a better score, the non-comment part of the program can be rewritten using only the 7 distinct characters that are universal for Python. Is this all valid?$endgroup$
– xnor
2 hours ago
$begingroup$
It looks to me like you can get a near-optimal score in Python by writing
print 123-len(open(__file__).read())
followed by #
then one of each byte not used so far (except some control characters), with prefixes chopping those bytes. Adjust 123 to whatever centers the range of outputs around 0. For a better score, the non-comment part of the program can be rewritten using only the 7 distinct characters that are universal for Python. Is this all valid?$endgroup$
– xnor
2 hours ago
1
1
$begingroup$
@JoKing I do include negatives, when the difference is negative.
$endgroup$
– xnor
2 hours ago
$begingroup$
@JoKing I do include negatives, when the difference is negative.
$endgroup$
– xnor
2 hours ago
|
show 7 more comments
5 Answers
5
active
oldest
votes
$begingroup$
vim, 14³ / 53 = 51.77
i10<esc>X<c-x>r2hx<c-a>Pa<del>4<c-c>d^s5<c-o>I-<c-o>$<c-o>C6<c-h>7
Try it online! (all prefixes)
Breakdown:
i1 1
0 10
<esc>X 0
<c-x> -1 <c-x> decrements
r2 -2
hx 2 hx is X, but we've already used that
<c-a> 3 <c-a> increments
P -3 paste the - from two steps ago
a<del>4 -4
<c-c>d^ 4 <c-c> is an <esc> alternative
s5 5
<c-o>I-<c-o>$<c-o> -5 <c-o> allows a single normal mode input
C6 -6 trailing <c-o> from previous line used here
<c-h>7 -7 <c-h> = backspace
$endgroup$
add a comment |
$begingroup$
TI-BASIC (TI-84+ CE), $238^3/14161 = 952.0$
118-length("+×/ABCDEFGHIJK...
The 256 bytes in TI-BASIC break down thusly:
- 240 bytes are one-byte tokens that can be quoted
- 11 are the start of two-byte tokens
- 2 are unused
- The remaining 3 are the
"
,→
, and newline characters which break strings.
The string contains all 237 allowable bytes in the first category not already in 118-length(
.
The program calculates 238 distinct integers, ranging from 118 down to -119. The score is therefore $$ frac{238^3}{sum_{n = -119}^{118} |n|} = 952.$$
$endgroup$
add a comment |
$begingroup$
Lenguage, 256³ / 16384 = 1024
The source code of the solution can be described as follows:
183662808731984092 0x00 bytes
4775233027031586288 0x01 bytes
27 0x02 bytes
81 0x03 bytes
128931291729852829668 0x04 bytes
108 0x05 bytes
648 0x06 bytes
81 0x07 bytes
2079 0x08 bytes
27 0x09 bytes
3481144876706026401009 0x0A bytes
108 0x0B bytes
2808 0x0C bytes
27 0x0D bytes
17496 0x0E bytes
81 0x0F bytes
2079 0x10 bytes
27 0x11 bytes
56106 0x12 bytes
756 0x13 bytes
93990911671062712827216 0x14 bytes
108 0x15 bytes
2808 0x16 bytes
27 0x17 bytes
75789 0x18 bytes
756 0x19 bytes
474552 0x1A bytes
27 0x1B bytes
81 0x1C bytes
56025 0x1D bytes
756 0x1E bytes
1514835 0x1F bytes
20439 0x20 bytes
2537754615118693246334805 0x21 bytes
108 0x22 bytes
2808 0x23 bytes
27 0x24 bytes
75789 0x25 bytes
756 0x26 bytes
2046276 0x27 bytes
20439 0x28 bytes
12812877 0x29 bytes
108 0x2A bytes
729 0x2B bytes
2079 0x2C bytes
27 0x2D bytes
1512648 0x2E bytes
40920957 0x2F bytes
1689866867948183303767857 0x30 bytes
66829507740256534347823839 0x31 bytes
2808 0x32 bytes
27 0x33 bytes
75789 0x34 bytes
756 0x35 bytes
2046276 0x36 bytes
20439 0x37 bytes
55249425 0x38 bytes
551880 0x39 bytes
345947652 0x3A bytes
2916 0x3B bytes
27 0x3C bytes
19656 0x3D bytes
56133 0x3E bytes
40842225 0x3F bytes
1104865839 0x40 bytes
45626405434600949201732247 0x41 bytes
1804396708986926427391243545 0x42 bytes
27 0x43 bytes
75789 0x44 bytes
756 0x45 bytes
2046276 0x46 bytes
20439 0x47 bytes
55249425 0x48 bytes
551880 0x49 bytes
1491734448 0x4A bytes
9355487364 0x4B bytes
78732 0x4C bytes
756 0x4D bytes
530685 0x4E bytes
1515591 0x4F bytes
1102740075 0x50 bytes
29831377653 0x51 bytes
1231912946734225628446770696 0x52 bytes
48718711142647013539563576444 0x53 bytes
2066715 0x54 bytes
55801305 0x55 bytes
1506635235 0x56 bytes
292874988897 0x57 bytes
2125764 0x58 bytes
14348907 0x59 bytes
40920957 0x5A bytes
29773982025 0x5B bytes
33261649561824092773510005450 0x5C bytes
1315405200851469365568216563988 0x5D bytes
55801305 0x5E bytes
1506635235 0x5F bytes
7948303851537 0x60 bytes
57395628 0x61 bytes
387420489 0x62 bytes
1104865839 0x63 bytes
803897514675 0x64 bytes
898064538169250504884770147177 0x65 bytes
35515940422989672870341847227676 0x66 bytes
1506635235 0x67 bytes
40679151345 0x68 bytes
214604203991472 0x69 bytes
1549681956 0x6A bytes
10460353203 0x6B bytes
29831377653 0x6C bytes
24001245795414021635055080475036 0x6D bytes
246496735155742018538946394995 0x6E bytes
958930391420721167499229875147252 0x6F bytes
40679151345 0x70 bytes
5795411844856032 0x71 bytes
41841412812 0x72 bytes
282429536481 0x73 bytes
805447196631 0x74 bytes
648033636476178584146487172825972 0x75 bytes
108 0x76 bytes
6655411849205034500551552664784 0x77 bytes
25891120568359471522479206628975804 0x78 bytes
1098337086315 0x79 bytes
156484875126743748 0x7A bytes
21747074309037 0x7B bytes
17496908184856821771955153666301244 0x7C bytes
108 0x7D bytes
2808 0x7E bytes
27 0x7F bytes
81 0x80 bytes
179696119928535931514891921949087 0x81 bytes
699060255345705731106938578982346708 0x82 bytes
4225121283523411674 0x83 bytes
472416520991134187843376319996477587 0x84 bytes
108 0x85 bytes
2808 0x86 bytes
27 0x87 bytes
75789 0x88 bytes
108 0x89 bytes
729 0x8A bytes
2079 0x8B bytes
27 0x8C bytes
4851795238070470150902081892625349 0x8D bytes
18874626894334054739887341632523361116 0x8E bytes
114078274655132115171 0x8F bytes
12755246066760623071771160639904894849 0x90 bytes
108 0x91 bytes
2808 0x92 bytes
27 0x93 bytes
75789 0x94 bytes
756 0x95 bytes
2046276 0x96 bytes
2916 0x97 bytes
27 0x98 bytes
19656 0x99 bytes
56133 0x9A bytes
130998471427902694074356211100885179 0x9B bytes
854006569949556303994892977044130020645 0x9C bytes
108 0x9D bytes
2808 0x9E bytes
27 0x9F bytes
75789 0xA0 bytes
756 0xA1 bytes
2046276 0xA2 bytes
55269864 0xA3 bytes
78732 0xA4 bytes
756 0xA5 bytes
530685 0xA6 bytes
1515591 0xA7 bytes
3536958728553372740007617699723899860 0xA8 bytes
23058177388638020207862110380191510557388 0xA9 bytes
108 0xAA bytes
2808 0xAB bytes
27 0xAC bytes
75789 0xAD bytes
756 0xAE bytes
2046276 0xAF bytes
20439 0xB0 bytes
55249425 0xB1 bytes
1492286328 0xB2 bytes
2125764 0xB3 bytes
14348907 0xB4 bytes
40920957 0xB5 bytes
622666287378897486676257185943063330345696 0xB6 bytes
108 0xB7 bytes
2808 0xB8 bytes
27 0xB9 bytes
75789 0xBA bytes
756 0xBB bytes
2046276 0xBC bytes
20439 0xBD bytes
55249425 0xBE bytes
1492286328 0xBF bytes
40291730856 0xC0 bytes
57395628 0xC1 bytes
387420489 0xC2 bytes
1104865839 0xC3 bytes
16811989759230232140258944020462709919333792 0xC4 bytes
108 0xC5 bytes
2808 0xC6 bytes
27 0xC7 bytes
75789 0xC8 bytes
756 0xC9 bytes
2046276 0xCA bytes
20439 0xCB bytes
55249425 0xCC bytes
551880 0xCD bytes
1491734448 0xCE bytes
40291730856 0xCF bytes
1087876733112 0xD0 bytes
1549681956 0xD1 bytes
10460353203 0xD2 bytes
29831377653 0xD3 bytes
453923723499216267786991488552493167822012492 0xD4 bytes
2808 0xD5 bytes
27 0xD6 bytes
75789 0xD7 bytes
756 0xD8 bytes
2046276 0xD9 bytes
20439 0xDA bytes
55249425 0xDB bytes
551880 0xDC bytes
1491734448 0xDD bytes
40291730856 0xDE bytes
1087876733112 0xDF bytes
29372671794024 0xE0 bytes
324270949293 0xE1 bytes
805447196631 0xE2 bytes
12255940534478839230248770190917315531194337311 0xE3 bytes
76545 0xE4 bytes
2066715 0xE5 bytes
55801305 0xE6 bytes
1506635235 0xE7 bytes
832318279426764 0xE8 bytes
21747074309037 0xE9 bytes
330910394430928659216716795154767519342247107424 0xEA bytes
2066715 0xEB bytes
55801305 0xEC bytes
1506635235 0xED bytes
22472634223673946 0xEE bytes
8934580649635073798851353469178723609411678244474 0xEF bytes
55801305 0xF0 bytes
1506635235 0xF1 bytes
40679151345 0xF2 bytes
606761124039196515 0xF3 bytes
241233677540146992568986543667825537454115312600825 0xF4 bytes
1506635235 0xF5 bytes
40679151345 0xF6 bytes
6513309293583968799362636679031305893812560835614495 0xF7 bytes
40679151345 0xF8 bytes
1098337086315 0xF9 bytes
175859350926767157582791190333845259132939142561591365 0xFA bytes
1098337086315 0xFB bytes
4748202475022713254735362139013821996589386504264297360 0xFC bytes
29655101330505 0xFD bytes
128201466825613257877854777753373193907913435615136028720 0xFE bytes
3461439604291557962702078999341076235513663562296408699075 0xFF bytes
Each run of identical bytes combined with the previous runs constitutes a prefix, and the full program is all the strings described above concatenated.
This is an optimal score. (The programs print all numbers from -127 to 128 inclusive.)
To create this answer, first, I copied the Java answer here for generating brainfuck programs to print a string. I ran it with this main
function:
public static void main(String args) {
for (int i = -127; i <= 128; ++i) generate(""+i);
}
Then, I ran this Ruby script to generate the human-readable text shown here:
#!/usr/bin/ruby
nums = File.open('f').map do |line|
line.chomp.sub(/^+/, '>+').chars.map{|ch|
'+-><.,'.index(ch).to_s(3).rjust(3,?0)
}.join.to_i 3
end
puts ([0]+nums.sort).each_cons(2).map.with_index{|x,i|"#{x[1]-x[0]} 0x#{i.to_s(16).rjust(2,?0).upcase} bytes"}*"n"
The largest program is 3594571896764310192036774345469579167648804468538578264427 bytes long (and prints -90
).
$endgroup$
$begingroup$
Props for the speed and practical problem-solving skill!
$endgroup$
– lirtosiast
38 mins ago
add a comment |
$begingroup$
Python 3, $(6^{3})/12 = 18$
0x1-2+3|True*~4
This is a snippet.
The individual prefix snippets are:
0 # gives 0
0x1 # gives 1 (hex syntax)
0x1-2 # gives -1 (1 minus 2)
0x1-2+3 # gives 2 (-1 plus 3)
0x1-2+3|True # gives 3 (True == 1; 2 bitwise-OR 1 == 3)
0x1-2+3|True*~4 # gives -5 (~4 == -5; True*~4 == -5; 2|-5 == -5)
Python's bitwise operators treat negative integers as two's complement with unlimited 1
s to the right, so -5
is treated as ...11111011
, which when ORed with ...000010
gives ...11111011
unchanged.
$endgroup$
add a comment |
$begingroup$
Python 2, $11^3/53 = 25.1132075472$
015-8*2+6/3&9%7ifelse 4^ord('b')
Prefixes:
0 # 0
01 # 1
015 # 13 (octal)
015-8 # 5
015-8*2 # -3
015-8*2+6 # 3
015-8*2+6/3 # -1
015-8*2+6/3&9 # 9 (-1 bitwise-AND 9 = 9)
015-8*2+6/3&9%7 # 2
015-8*2+6/3&9%7ifelse 4 # 4
015-8*2+6/3&9%7ifelse 4^ord('b') # 12 (4 bitwise-XOR 8 -- OR would also work)
Not optimal, but the best I could personally find with this particular structure.
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "200"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f179751%2fthe-real-treasure-was-the-numbers-we-made-along-the-way%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
vim, 14³ / 53 = 51.77
i10<esc>X<c-x>r2hx<c-a>Pa<del>4<c-c>d^s5<c-o>I-<c-o>$<c-o>C6<c-h>7
Try it online! (all prefixes)
Breakdown:
i1 1
0 10
<esc>X 0
<c-x> -1 <c-x> decrements
r2 -2
hx 2 hx is X, but we've already used that
<c-a> 3 <c-a> increments
P -3 paste the - from two steps ago
a<del>4 -4
<c-c>d^ 4 <c-c> is an <esc> alternative
s5 5
<c-o>I-<c-o>$<c-o> -5 <c-o> allows a single normal mode input
C6 -6 trailing <c-o> from previous line used here
<c-h>7 -7 <c-h> = backspace
$endgroup$
add a comment |
$begingroup$
vim, 14³ / 53 = 51.77
i10<esc>X<c-x>r2hx<c-a>Pa<del>4<c-c>d^s5<c-o>I-<c-o>$<c-o>C6<c-h>7
Try it online! (all prefixes)
Breakdown:
i1 1
0 10
<esc>X 0
<c-x> -1 <c-x> decrements
r2 -2
hx 2 hx is X, but we've already used that
<c-a> 3 <c-a> increments
P -3 paste the - from two steps ago
a<del>4 -4
<c-c>d^ 4 <c-c> is an <esc> alternative
s5 5
<c-o>I-<c-o>$<c-o> -5 <c-o> allows a single normal mode input
C6 -6 trailing <c-o> from previous line used here
<c-h>7 -7 <c-h> = backspace
$endgroup$
add a comment |
$begingroup$
vim, 14³ / 53 = 51.77
i10<esc>X<c-x>r2hx<c-a>Pa<del>4<c-c>d^s5<c-o>I-<c-o>$<c-o>C6<c-h>7
Try it online! (all prefixes)
Breakdown:
i1 1
0 10
<esc>X 0
<c-x> -1 <c-x> decrements
r2 -2
hx 2 hx is X, but we've already used that
<c-a> 3 <c-a> increments
P -3 paste the - from two steps ago
a<del>4 -4
<c-c>d^ 4 <c-c> is an <esc> alternative
s5 5
<c-o>I-<c-o>$<c-o> -5 <c-o> allows a single normal mode input
C6 -6 trailing <c-o> from previous line used here
<c-h>7 -7 <c-h> = backspace
$endgroup$
vim, 14³ / 53 = 51.77
i10<esc>X<c-x>r2hx<c-a>Pa<del>4<c-c>d^s5<c-o>I-<c-o>$<c-o>C6<c-h>7
Try it online! (all prefixes)
Breakdown:
i1 1
0 10
<esc>X 0
<c-x> -1 <c-x> decrements
r2 -2
hx 2 hx is X, but we've already used that
<c-a> 3 <c-a> increments
P -3 paste the - from two steps ago
a<del>4 -4
<c-c>d^ 4 <c-c> is an <esc> alternative
s5 5
<c-o>I-<c-o>$<c-o> -5 <c-o> allows a single normal mode input
C6 -6 trailing <c-o> from previous line used here
<c-h>7 -7 <c-h> = backspace
edited 1 hour ago
answered 1 hour ago
Doorknob♦Doorknob
54.6k17114348
54.6k17114348
add a comment |
add a comment |
$begingroup$
TI-BASIC (TI-84+ CE), $238^3/14161 = 952.0$
118-length("+×/ABCDEFGHIJK...
The 256 bytes in TI-BASIC break down thusly:
- 240 bytes are one-byte tokens that can be quoted
- 11 are the start of two-byte tokens
- 2 are unused
- The remaining 3 are the
"
,→
, and newline characters which break strings.
The string contains all 237 allowable bytes in the first category not already in 118-length(
.
The program calculates 238 distinct integers, ranging from 118 down to -119. The score is therefore $$ frac{238^3}{sum_{n = -119}^{118} |n|} = 952.$$
$endgroup$
add a comment |
$begingroup$
TI-BASIC (TI-84+ CE), $238^3/14161 = 952.0$
118-length("+×/ABCDEFGHIJK...
The 256 bytes in TI-BASIC break down thusly:
- 240 bytes are one-byte tokens that can be quoted
- 11 are the start of two-byte tokens
- 2 are unused
- The remaining 3 are the
"
,→
, and newline characters which break strings.
The string contains all 237 allowable bytes in the first category not already in 118-length(
.
The program calculates 238 distinct integers, ranging from 118 down to -119. The score is therefore $$ frac{238^3}{sum_{n = -119}^{118} |n|} = 952.$$
$endgroup$
add a comment |
$begingroup$
TI-BASIC (TI-84+ CE), $238^3/14161 = 952.0$
118-length("+×/ABCDEFGHIJK...
The 256 bytes in TI-BASIC break down thusly:
- 240 bytes are one-byte tokens that can be quoted
- 11 are the start of two-byte tokens
- 2 are unused
- The remaining 3 are the
"
,→
, and newline characters which break strings.
The string contains all 237 allowable bytes in the first category not already in 118-length(
.
The program calculates 238 distinct integers, ranging from 118 down to -119. The score is therefore $$ frac{238^3}{sum_{n = -119}^{118} |n|} = 952.$$
$endgroup$
TI-BASIC (TI-84+ CE), $238^3/14161 = 952.0$
118-length("+×/ABCDEFGHIJK...
The 256 bytes in TI-BASIC break down thusly:
- 240 bytes are one-byte tokens that can be quoted
- 11 are the start of two-byte tokens
- 2 are unused
- The remaining 3 are the
"
,→
, and newline characters which break strings.
The string contains all 237 allowable bytes in the first category not already in 118-length(
.
The program calculates 238 distinct integers, ranging from 118 down to -119. The score is therefore $$ frac{238^3}{sum_{n = -119}^{118} |n|} = 952.$$
edited 55 mins ago
answered 1 hour ago
lirtosiastlirtosiast
17.5k437108
17.5k437108
add a comment |
add a comment |
$begingroup$
Lenguage, 256³ / 16384 = 1024
The source code of the solution can be described as follows:
183662808731984092 0x00 bytes
4775233027031586288 0x01 bytes
27 0x02 bytes
81 0x03 bytes
128931291729852829668 0x04 bytes
108 0x05 bytes
648 0x06 bytes
81 0x07 bytes
2079 0x08 bytes
27 0x09 bytes
3481144876706026401009 0x0A bytes
108 0x0B bytes
2808 0x0C bytes
27 0x0D bytes
17496 0x0E bytes
81 0x0F bytes
2079 0x10 bytes
27 0x11 bytes
56106 0x12 bytes
756 0x13 bytes
93990911671062712827216 0x14 bytes
108 0x15 bytes
2808 0x16 bytes
27 0x17 bytes
75789 0x18 bytes
756 0x19 bytes
474552 0x1A bytes
27 0x1B bytes
81 0x1C bytes
56025 0x1D bytes
756 0x1E bytes
1514835 0x1F bytes
20439 0x20 bytes
2537754615118693246334805 0x21 bytes
108 0x22 bytes
2808 0x23 bytes
27 0x24 bytes
75789 0x25 bytes
756 0x26 bytes
2046276 0x27 bytes
20439 0x28 bytes
12812877 0x29 bytes
108 0x2A bytes
729 0x2B bytes
2079 0x2C bytes
27 0x2D bytes
1512648 0x2E bytes
40920957 0x2F bytes
1689866867948183303767857 0x30 bytes
66829507740256534347823839 0x31 bytes
2808 0x32 bytes
27 0x33 bytes
75789 0x34 bytes
756 0x35 bytes
2046276 0x36 bytes
20439 0x37 bytes
55249425 0x38 bytes
551880 0x39 bytes
345947652 0x3A bytes
2916 0x3B bytes
27 0x3C bytes
19656 0x3D bytes
56133 0x3E bytes
40842225 0x3F bytes
1104865839 0x40 bytes
45626405434600949201732247 0x41 bytes
1804396708986926427391243545 0x42 bytes
27 0x43 bytes
75789 0x44 bytes
756 0x45 bytes
2046276 0x46 bytes
20439 0x47 bytes
55249425 0x48 bytes
551880 0x49 bytes
1491734448 0x4A bytes
9355487364 0x4B bytes
78732 0x4C bytes
756 0x4D bytes
530685 0x4E bytes
1515591 0x4F bytes
1102740075 0x50 bytes
29831377653 0x51 bytes
1231912946734225628446770696 0x52 bytes
48718711142647013539563576444 0x53 bytes
2066715 0x54 bytes
55801305 0x55 bytes
1506635235 0x56 bytes
292874988897 0x57 bytes
2125764 0x58 bytes
14348907 0x59 bytes
40920957 0x5A bytes
29773982025 0x5B bytes
33261649561824092773510005450 0x5C bytes
1315405200851469365568216563988 0x5D bytes
55801305 0x5E bytes
1506635235 0x5F bytes
7948303851537 0x60 bytes
57395628 0x61 bytes
387420489 0x62 bytes
1104865839 0x63 bytes
803897514675 0x64 bytes
898064538169250504884770147177 0x65 bytes
35515940422989672870341847227676 0x66 bytes
1506635235 0x67 bytes
40679151345 0x68 bytes
214604203991472 0x69 bytes
1549681956 0x6A bytes
10460353203 0x6B bytes
29831377653 0x6C bytes
24001245795414021635055080475036 0x6D bytes
246496735155742018538946394995 0x6E bytes
958930391420721167499229875147252 0x6F bytes
40679151345 0x70 bytes
5795411844856032 0x71 bytes
41841412812 0x72 bytes
282429536481 0x73 bytes
805447196631 0x74 bytes
648033636476178584146487172825972 0x75 bytes
108 0x76 bytes
6655411849205034500551552664784 0x77 bytes
25891120568359471522479206628975804 0x78 bytes
1098337086315 0x79 bytes
156484875126743748 0x7A bytes
21747074309037 0x7B bytes
17496908184856821771955153666301244 0x7C bytes
108 0x7D bytes
2808 0x7E bytes
27 0x7F bytes
81 0x80 bytes
179696119928535931514891921949087 0x81 bytes
699060255345705731106938578982346708 0x82 bytes
4225121283523411674 0x83 bytes
472416520991134187843376319996477587 0x84 bytes
108 0x85 bytes
2808 0x86 bytes
27 0x87 bytes
75789 0x88 bytes
108 0x89 bytes
729 0x8A bytes
2079 0x8B bytes
27 0x8C bytes
4851795238070470150902081892625349 0x8D bytes
18874626894334054739887341632523361116 0x8E bytes
114078274655132115171 0x8F bytes
12755246066760623071771160639904894849 0x90 bytes
108 0x91 bytes
2808 0x92 bytes
27 0x93 bytes
75789 0x94 bytes
756 0x95 bytes
2046276 0x96 bytes
2916 0x97 bytes
27 0x98 bytes
19656 0x99 bytes
56133 0x9A bytes
130998471427902694074356211100885179 0x9B bytes
854006569949556303994892977044130020645 0x9C bytes
108 0x9D bytes
2808 0x9E bytes
27 0x9F bytes
75789 0xA0 bytes
756 0xA1 bytes
2046276 0xA2 bytes
55269864 0xA3 bytes
78732 0xA4 bytes
756 0xA5 bytes
530685 0xA6 bytes
1515591 0xA7 bytes
3536958728553372740007617699723899860 0xA8 bytes
23058177388638020207862110380191510557388 0xA9 bytes
108 0xAA bytes
2808 0xAB bytes
27 0xAC bytes
75789 0xAD bytes
756 0xAE bytes
2046276 0xAF bytes
20439 0xB0 bytes
55249425 0xB1 bytes
1492286328 0xB2 bytes
2125764 0xB3 bytes
14348907 0xB4 bytes
40920957 0xB5 bytes
622666287378897486676257185943063330345696 0xB6 bytes
108 0xB7 bytes
2808 0xB8 bytes
27 0xB9 bytes
75789 0xBA bytes
756 0xBB bytes
2046276 0xBC bytes
20439 0xBD bytes
55249425 0xBE bytes
1492286328 0xBF bytes
40291730856 0xC0 bytes
57395628 0xC1 bytes
387420489 0xC2 bytes
1104865839 0xC3 bytes
16811989759230232140258944020462709919333792 0xC4 bytes
108 0xC5 bytes
2808 0xC6 bytes
27 0xC7 bytes
75789 0xC8 bytes
756 0xC9 bytes
2046276 0xCA bytes
20439 0xCB bytes
55249425 0xCC bytes
551880 0xCD bytes
1491734448 0xCE bytes
40291730856 0xCF bytes
1087876733112 0xD0 bytes
1549681956 0xD1 bytes
10460353203 0xD2 bytes
29831377653 0xD3 bytes
453923723499216267786991488552493167822012492 0xD4 bytes
2808 0xD5 bytes
27 0xD6 bytes
75789 0xD7 bytes
756 0xD8 bytes
2046276 0xD9 bytes
20439 0xDA bytes
55249425 0xDB bytes
551880 0xDC bytes
1491734448 0xDD bytes
40291730856 0xDE bytes
1087876733112 0xDF bytes
29372671794024 0xE0 bytes
324270949293 0xE1 bytes
805447196631 0xE2 bytes
12255940534478839230248770190917315531194337311 0xE3 bytes
76545 0xE4 bytes
2066715 0xE5 bytes
55801305 0xE6 bytes
1506635235 0xE7 bytes
832318279426764 0xE8 bytes
21747074309037 0xE9 bytes
330910394430928659216716795154767519342247107424 0xEA bytes
2066715 0xEB bytes
55801305 0xEC bytes
1506635235 0xED bytes
22472634223673946 0xEE bytes
8934580649635073798851353469178723609411678244474 0xEF bytes
55801305 0xF0 bytes
1506635235 0xF1 bytes
40679151345 0xF2 bytes
606761124039196515 0xF3 bytes
241233677540146992568986543667825537454115312600825 0xF4 bytes
1506635235 0xF5 bytes
40679151345 0xF6 bytes
6513309293583968799362636679031305893812560835614495 0xF7 bytes
40679151345 0xF8 bytes
1098337086315 0xF9 bytes
175859350926767157582791190333845259132939142561591365 0xFA bytes
1098337086315 0xFB bytes
4748202475022713254735362139013821996589386504264297360 0xFC bytes
29655101330505 0xFD bytes
128201466825613257877854777753373193907913435615136028720 0xFE bytes
3461439604291557962702078999341076235513663562296408699075 0xFF bytes
Each run of identical bytes combined with the previous runs constitutes a prefix, and the full program is all the strings described above concatenated.
This is an optimal score. (The programs print all numbers from -127 to 128 inclusive.)
To create this answer, first, I copied the Java answer here for generating brainfuck programs to print a string. I ran it with this main
function:
public static void main(String args) {
for (int i = -127; i <= 128; ++i) generate(""+i);
}
Then, I ran this Ruby script to generate the human-readable text shown here:
#!/usr/bin/ruby
nums = File.open('f').map do |line|
line.chomp.sub(/^+/, '>+').chars.map{|ch|
'+-><.,'.index(ch).to_s(3).rjust(3,?0)
}.join.to_i 3
end
puts ([0]+nums.sort).each_cons(2).map.with_index{|x,i|"#{x[1]-x[0]} 0x#{i.to_s(16).rjust(2,?0).upcase} bytes"}*"n"
The largest program is 3594571896764310192036774345469579167648804468538578264427 bytes long (and prints -90
).
$endgroup$
$begingroup$
Props for the speed and practical problem-solving skill!
$endgroup$
– lirtosiast
38 mins ago
add a comment |
$begingroup$
Lenguage, 256³ / 16384 = 1024
The source code of the solution can be described as follows:
183662808731984092 0x00 bytes
4775233027031586288 0x01 bytes
27 0x02 bytes
81 0x03 bytes
128931291729852829668 0x04 bytes
108 0x05 bytes
648 0x06 bytes
81 0x07 bytes
2079 0x08 bytes
27 0x09 bytes
3481144876706026401009 0x0A bytes
108 0x0B bytes
2808 0x0C bytes
27 0x0D bytes
17496 0x0E bytes
81 0x0F bytes
2079 0x10 bytes
27 0x11 bytes
56106 0x12 bytes
756 0x13 bytes
93990911671062712827216 0x14 bytes
108 0x15 bytes
2808 0x16 bytes
27 0x17 bytes
75789 0x18 bytes
756 0x19 bytes
474552 0x1A bytes
27 0x1B bytes
81 0x1C bytes
56025 0x1D bytes
756 0x1E bytes
1514835 0x1F bytes
20439 0x20 bytes
2537754615118693246334805 0x21 bytes
108 0x22 bytes
2808 0x23 bytes
27 0x24 bytes
75789 0x25 bytes
756 0x26 bytes
2046276 0x27 bytes
20439 0x28 bytes
12812877 0x29 bytes
108 0x2A bytes
729 0x2B bytes
2079 0x2C bytes
27 0x2D bytes
1512648 0x2E bytes
40920957 0x2F bytes
1689866867948183303767857 0x30 bytes
66829507740256534347823839 0x31 bytes
2808 0x32 bytes
27 0x33 bytes
75789 0x34 bytes
756 0x35 bytes
2046276 0x36 bytes
20439 0x37 bytes
55249425 0x38 bytes
551880 0x39 bytes
345947652 0x3A bytes
2916 0x3B bytes
27 0x3C bytes
19656 0x3D bytes
56133 0x3E bytes
40842225 0x3F bytes
1104865839 0x40 bytes
45626405434600949201732247 0x41 bytes
1804396708986926427391243545 0x42 bytes
27 0x43 bytes
75789 0x44 bytes
756 0x45 bytes
2046276 0x46 bytes
20439 0x47 bytes
55249425 0x48 bytes
551880 0x49 bytes
1491734448 0x4A bytes
9355487364 0x4B bytes
78732 0x4C bytes
756 0x4D bytes
530685 0x4E bytes
1515591 0x4F bytes
1102740075 0x50 bytes
29831377653 0x51 bytes
1231912946734225628446770696 0x52 bytes
48718711142647013539563576444 0x53 bytes
2066715 0x54 bytes
55801305 0x55 bytes
1506635235 0x56 bytes
292874988897 0x57 bytes
2125764 0x58 bytes
14348907 0x59 bytes
40920957 0x5A bytes
29773982025 0x5B bytes
33261649561824092773510005450 0x5C bytes
1315405200851469365568216563988 0x5D bytes
55801305 0x5E bytes
1506635235 0x5F bytes
7948303851537 0x60 bytes
57395628 0x61 bytes
387420489 0x62 bytes
1104865839 0x63 bytes
803897514675 0x64 bytes
898064538169250504884770147177 0x65 bytes
35515940422989672870341847227676 0x66 bytes
1506635235 0x67 bytes
40679151345 0x68 bytes
214604203991472 0x69 bytes
1549681956 0x6A bytes
10460353203 0x6B bytes
29831377653 0x6C bytes
24001245795414021635055080475036 0x6D bytes
246496735155742018538946394995 0x6E bytes
958930391420721167499229875147252 0x6F bytes
40679151345 0x70 bytes
5795411844856032 0x71 bytes
41841412812 0x72 bytes
282429536481 0x73 bytes
805447196631 0x74 bytes
648033636476178584146487172825972 0x75 bytes
108 0x76 bytes
6655411849205034500551552664784 0x77 bytes
25891120568359471522479206628975804 0x78 bytes
1098337086315 0x79 bytes
156484875126743748 0x7A bytes
21747074309037 0x7B bytes
17496908184856821771955153666301244 0x7C bytes
108 0x7D bytes
2808 0x7E bytes
27 0x7F bytes
81 0x80 bytes
179696119928535931514891921949087 0x81 bytes
699060255345705731106938578982346708 0x82 bytes
4225121283523411674 0x83 bytes
472416520991134187843376319996477587 0x84 bytes
108 0x85 bytes
2808 0x86 bytes
27 0x87 bytes
75789 0x88 bytes
108 0x89 bytes
729 0x8A bytes
2079 0x8B bytes
27 0x8C bytes
4851795238070470150902081892625349 0x8D bytes
18874626894334054739887341632523361116 0x8E bytes
114078274655132115171 0x8F bytes
12755246066760623071771160639904894849 0x90 bytes
108 0x91 bytes
2808 0x92 bytes
27 0x93 bytes
75789 0x94 bytes
756 0x95 bytes
2046276 0x96 bytes
2916 0x97 bytes
27 0x98 bytes
19656 0x99 bytes
56133 0x9A bytes
130998471427902694074356211100885179 0x9B bytes
854006569949556303994892977044130020645 0x9C bytes
108 0x9D bytes
2808 0x9E bytes
27 0x9F bytes
75789 0xA0 bytes
756 0xA1 bytes
2046276 0xA2 bytes
55269864 0xA3 bytes
78732 0xA4 bytes
756 0xA5 bytes
530685 0xA6 bytes
1515591 0xA7 bytes
3536958728553372740007617699723899860 0xA8 bytes
23058177388638020207862110380191510557388 0xA9 bytes
108 0xAA bytes
2808 0xAB bytes
27 0xAC bytes
75789 0xAD bytes
756 0xAE bytes
2046276 0xAF bytes
20439 0xB0 bytes
55249425 0xB1 bytes
1492286328 0xB2 bytes
2125764 0xB3 bytes
14348907 0xB4 bytes
40920957 0xB5 bytes
622666287378897486676257185943063330345696 0xB6 bytes
108 0xB7 bytes
2808 0xB8 bytes
27 0xB9 bytes
75789 0xBA bytes
756 0xBB bytes
2046276 0xBC bytes
20439 0xBD bytes
55249425 0xBE bytes
1492286328 0xBF bytes
40291730856 0xC0 bytes
57395628 0xC1 bytes
387420489 0xC2 bytes
1104865839 0xC3 bytes
16811989759230232140258944020462709919333792 0xC4 bytes
108 0xC5 bytes
2808 0xC6 bytes
27 0xC7 bytes
75789 0xC8 bytes
756 0xC9 bytes
2046276 0xCA bytes
20439 0xCB bytes
55249425 0xCC bytes
551880 0xCD bytes
1491734448 0xCE bytes
40291730856 0xCF bytes
1087876733112 0xD0 bytes
1549681956 0xD1 bytes
10460353203 0xD2 bytes
29831377653 0xD3 bytes
453923723499216267786991488552493167822012492 0xD4 bytes
2808 0xD5 bytes
27 0xD6 bytes
75789 0xD7 bytes
756 0xD8 bytes
2046276 0xD9 bytes
20439 0xDA bytes
55249425 0xDB bytes
551880 0xDC bytes
1491734448 0xDD bytes
40291730856 0xDE bytes
1087876733112 0xDF bytes
29372671794024 0xE0 bytes
324270949293 0xE1 bytes
805447196631 0xE2 bytes
12255940534478839230248770190917315531194337311 0xE3 bytes
76545 0xE4 bytes
2066715 0xE5 bytes
55801305 0xE6 bytes
1506635235 0xE7 bytes
832318279426764 0xE8 bytes
21747074309037 0xE9 bytes
330910394430928659216716795154767519342247107424 0xEA bytes
2066715 0xEB bytes
55801305 0xEC bytes
1506635235 0xED bytes
22472634223673946 0xEE bytes
8934580649635073798851353469178723609411678244474 0xEF bytes
55801305 0xF0 bytes
1506635235 0xF1 bytes
40679151345 0xF2 bytes
606761124039196515 0xF3 bytes
241233677540146992568986543667825537454115312600825 0xF4 bytes
1506635235 0xF5 bytes
40679151345 0xF6 bytes
6513309293583968799362636679031305893812560835614495 0xF7 bytes
40679151345 0xF8 bytes
1098337086315 0xF9 bytes
175859350926767157582791190333845259132939142561591365 0xFA bytes
1098337086315 0xFB bytes
4748202475022713254735362139013821996589386504264297360 0xFC bytes
29655101330505 0xFD bytes
128201466825613257877854777753373193907913435615136028720 0xFE bytes
3461439604291557962702078999341076235513663562296408699075 0xFF bytes
Each run of identical bytes combined with the previous runs constitutes a prefix, and the full program is all the strings described above concatenated.
This is an optimal score. (The programs print all numbers from -127 to 128 inclusive.)
To create this answer, first, I copied the Java answer here for generating brainfuck programs to print a string. I ran it with this main
function:
public static void main(String args) {
for (int i = -127; i <= 128; ++i) generate(""+i);
}
Then, I ran this Ruby script to generate the human-readable text shown here:
#!/usr/bin/ruby
nums = File.open('f').map do |line|
line.chomp.sub(/^+/, '>+').chars.map{|ch|
'+-><.,'.index(ch).to_s(3).rjust(3,?0)
}.join.to_i 3
end
puts ([0]+nums.sort).each_cons(2).map.with_index{|x,i|"#{x[1]-x[0]} 0x#{i.to_s(16).rjust(2,?0).upcase} bytes"}*"n"
The largest program is 3594571896764310192036774345469579167648804468538578264427 bytes long (and prints -90
).
$endgroup$
$begingroup$
Props for the speed and practical problem-solving skill!
$endgroup$
– lirtosiast
38 mins ago
add a comment |
$begingroup$
Lenguage, 256³ / 16384 = 1024
The source code of the solution can be described as follows:
183662808731984092 0x00 bytes
4775233027031586288 0x01 bytes
27 0x02 bytes
81 0x03 bytes
128931291729852829668 0x04 bytes
108 0x05 bytes
648 0x06 bytes
81 0x07 bytes
2079 0x08 bytes
27 0x09 bytes
3481144876706026401009 0x0A bytes
108 0x0B bytes
2808 0x0C bytes
27 0x0D bytes
17496 0x0E bytes
81 0x0F bytes
2079 0x10 bytes
27 0x11 bytes
56106 0x12 bytes
756 0x13 bytes
93990911671062712827216 0x14 bytes
108 0x15 bytes
2808 0x16 bytes
27 0x17 bytes
75789 0x18 bytes
756 0x19 bytes
474552 0x1A bytes
27 0x1B bytes
81 0x1C bytes
56025 0x1D bytes
756 0x1E bytes
1514835 0x1F bytes
20439 0x20 bytes
2537754615118693246334805 0x21 bytes
108 0x22 bytes
2808 0x23 bytes
27 0x24 bytes
75789 0x25 bytes
756 0x26 bytes
2046276 0x27 bytes
20439 0x28 bytes
12812877 0x29 bytes
108 0x2A bytes
729 0x2B bytes
2079 0x2C bytes
27 0x2D bytes
1512648 0x2E bytes
40920957 0x2F bytes
1689866867948183303767857 0x30 bytes
66829507740256534347823839 0x31 bytes
2808 0x32 bytes
27 0x33 bytes
75789 0x34 bytes
756 0x35 bytes
2046276 0x36 bytes
20439 0x37 bytes
55249425 0x38 bytes
551880 0x39 bytes
345947652 0x3A bytes
2916 0x3B bytes
27 0x3C bytes
19656 0x3D bytes
56133 0x3E bytes
40842225 0x3F bytes
1104865839 0x40 bytes
45626405434600949201732247 0x41 bytes
1804396708986926427391243545 0x42 bytes
27 0x43 bytes
75789 0x44 bytes
756 0x45 bytes
2046276 0x46 bytes
20439 0x47 bytes
55249425 0x48 bytes
551880 0x49 bytes
1491734448 0x4A bytes
9355487364 0x4B bytes
78732 0x4C bytes
756 0x4D bytes
530685 0x4E bytes
1515591 0x4F bytes
1102740075 0x50 bytes
29831377653 0x51 bytes
1231912946734225628446770696 0x52 bytes
48718711142647013539563576444 0x53 bytes
2066715 0x54 bytes
55801305 0x55 bytes
1506635235 0x56 bytes
292874988897 0x57 bytes
2125764 0x58 bytes
14348907 0x59 bytes
40920957 0x5A bytes
29773982025 0x5B bytes
33261649561824092773510005450 0x5C bytes
1315405200851469365568216563988 0x5D bytes
55801305 0x5E bytes
1506635235 0x5F bytes
7948303851537 0x60 bytes
57395628 0x61 bytes
387420489 0x62 bytes
1104865839 0x63 bytes
803897514675 0x64 bytes
898064538169250504884770147177 0x65 bytes
35515940422989672870341847227676 0x66 bytes
1506635235 0x67 bytes
40679151345 0x68 bytes
214604203991472 0x69 bytes
1549681956 0x6A bytes
10460353203 0x6B bytes
29831377653 0x6C bytes
24001245795414021635055080475036 0x6D bytes
246496735155742018538946394995 0x6E bytes
958930391420721167499229875147252 0x6F bytes
40679151345 0x70 bytes
5795411844856032 0x71 bytes
41841412812 0x72 bytes
282429536481 0x73 bytes
805447196631 0x74 bytes
648033636476178584146487172825972 0x75 bytes
108 0x76 bytes
6655411849205034500551552664784 0x77 bytes
25891120568359471522479206628975804 0x78 bytes
1098337086315 0x79 bytes
156484875126743748 0x7A bytes
21747074309037 0x7B bytes
17496908184856821771955153666301244 0x7C bytes
108 0x7D bytes
2808 0x7E bytes
27 0x7F bytes
81 0x80 bytes
179696119928535931514891921949087 0x81 bytes
699060255345705731106938578982346708 0x82 bytes
4225121283523411674 0x83 bytes
472416520991134187843376319996477587 0x84 bytes
108 0x85 bytes
2808 0x86 bytes
27 0x87 bytes
75789 0x88 bytes
108 0x89 bytes
729 0x8A bytes
2079 0x8B bytes
27 0x8C bytes
4851795238070470150902081892625349 0x8D bytes
18874626894334054739887341632523361116 0x8E bytes
114078274655132115171 0x8F bytes
12755246066760623071771160639904894849 0x90 bytes
108 0x91 bytes
2808 0x92 bytes
27 0x93 bytes
75789 0x94 bytes
756 0x95 bytes
2046276 0x96 bytes
2916 0x97 bytes
27 0x98 bytes
19656 0x99 bytes
56133 0x9A bytes
130998471427902694074356211100885179 0x9B bytes
854006569949556303994892977044130020645 0x9C bytes
108 0x9D bytes
2808 0x9E bytes
27 0x9F bytes
75789 0xA0 bytes
756 0xA1 bytes
2046276 0xA2 bytes
55269864 0xA3 bytes
78732 0xA4 bytes
756 0xA5 bytes
530685 0xA6 bytes
1515591 0xA7 bytes
3536958728553372740007617699723899860 0xA8 bytes
23058177388638020207862110380191510557388 0xA9 bytes
108 0xAA bytes
2808 0xAB bytes
27 0xAC bytes
75789 0xAD bytes
756 0xAE bytes
2046276 0xAF bytes
20439 0xB0 bytes
55249425 0xB1 bytes
1492286328 0xB2 bytes
2125764 0xB3 bytes
14348907 0xB4 bytes
40920957 0xB5 bytes
622666287378897486676257185943063330345696 0xB6 bytes
108 0xB7 bytes
2808 0xB8 bytes
27 0xB9 bytes
75789 0xBA bytes
756 0xBB bytes
2046276 0xBC bytes
20439 0xBD bytes
55249425 0xBE bytes
1492286328 0xBF bytes
40291730856 0xC0 bytes
57395628 0xC1 bytes
387420489 0xC2 bytes
1104865839 0xC3 bytes
16811989759230232140258944020462709919333792 0xC4 bytes
108 0xC5 bytes
2808 0xC6 bytes
27 0xC7 bytes
75789 0xC8 bytes
756 0xC9 bytes
2046276 0xCA bytes
20439 0xCB bytes
55249425 0xCC bytes
551880 0xCD bytes
1491734448 0xCE bytes
40291730856 0xCF bytes
1087876733112 0xD0 bytes
1549681956 0xD1 bytes
10460353203 0xD2 bytes
29831377653 0xD3 bytes
453923723499216267786991488552493167822012492 0xD4 bytes
2808 0xD5 bytes
27 0xD6 bytes
75789 0xD7 bytes
756 0xD8 bytes
2046276 0xD9 bytes
20439 0xDA bytes
55249425 0xDB bytes
551880 0xDC bytes
1491734448 0xDD bytes
40291730856 0xDE bytes
1087876733112 0xDF bytes
29372671794024 0xE0 bytes
324270949293 0xE1 bytes
805447196631 0xE2 bytes
12255940534478839230248770190917315531194337311 0xE3 bytes
76545 0xE4 bytes
2066715 0xE5 bytes
55801305 0xE6 bytes
1506635235 0xE7 bytes
832318279426764 0xE8 bytes
21747074309037 0xE9 bytes
330910394430928659216716795154767519342247107424 0xEA bytes
2066715 0xEB bytes
55801305 0xEC bytes
1506635235 0xED bytes
22472634223673946 0xEE bytes
8934580649635073798851353469178723609411678244474 0xEF bytes
55801305 0xF0 bytes
1506635235 0xF1 bytes
40679151345 0xF2 bytes
606761124039196515 0xF3 bytes
241233677540146992568986543667825537454115312600825 0xF4 bytes
1506635235 0xF5 bytes
40679151345 0xF6 bytes
6513309293583968799362636679031305893812560835614495 0xF7 bytes
40679151345 0xF8 bytes
1098337086315 0xF9 bytes
175859350926767157582791190333845259132939142561591365 0xFA bytes
1098337086315 0xFB bytes
4748202475022713254735362139013821996589386504264297360 0xFC bytes
29655101330505 0xFD bytes
128201466825613257877854777753373193907913435615136028720 0xFE bytes
3461439604291557962702078999341076235513663562296408699075 0xFF bytes
Each run of identical bytes combined with the previous runs constitutes a prefix, and the full program is all the strings described above concatenated.
This is an optimal score. (The programs print all numbers from -127 to 128 inclusive.)
To create this answer, first, I copied the Java answer here for generating brainfuck programs to print a string. I ran it with this main
function:
public static void main(String args) {
for (int i = -127; i <= 128; ++i) generate(""+i);
}
Then, I ran this Ruby script to generate the human-readable text shown here:
#!/usr/bin/ruby
nums = File.open('f').map do |line|
line.chomp.sub(/^+/, '>+').chars.map{|ch|
'+-><.,'.index(ch).to_s(3).rjust(3,?0)
}.join.to_i 3
end
puts ([0]+nums.sort).each_cons(2).map.with_index{|x,i|"#{x[1]-x[0]} 0x#{i.to_s(16).rjust(2,?0).upcase} bytes"}*"n"
The largest program is 3594571896764310192036774345469579167648804468538578264427 bytes long (and prints -90
).
$endgroup$
Lenguage, 256³ / 16384 = 1024
The source code of the solution can be described as follows:
183662808731984092 0x00 bytes
4775233027031586288 0x01 bytes
27 0x02 bytes
81 0x03 bytes
128931291729852829668 0x04 bytes
108 0x05 bytes
648 0x06 bytes
81 0x07 bytes
2079 0x08 bytes
27 0x09 bytes
3481144876706026401009 0x0A bytes
108 0x0B bytes
2808 0x0C bytes
27 0x0D bytes
17496 0x0E bytes
81 0x0F bytes
2079 0x10 bytes
27 0x11 bytes
56106 0x12 bytes
756 0x13 bytes
93990911671062712827216 0x14 bytes
108 0x15 bytes
2808 0x16 bytes
27 0x17 bytes
75789 0x18 bytes
756 0x19 bytes
474552 0x1A bytes
27 0x1B bytes
81 0x1C bytes
56025 0x1D bytes
756 0x1E bytes
1514835 0x1F bytes
20439 0x20 bytes
2537754615118693246334805 0x21 bytes
108 0x22 bytes
2808 0x23 bytes
27 0x24 bytes
75789 0x25 bytes
756 0x26 bytes
2046276 0x27 bytes
20439 0x28 bytes
12812877 0x29 bytes
108 0x2A bytes
729 0x2B bytes
2079 0x2C bytes
27 0x2D bytes
1512648 0x2E bytes
40920957 0x2F bytes
1689866867948183303767857 0x30 bytes
66829507740256534347823839 0x31 bytes
2808 0x32 bytes
27 0x33 bytes
75789 0x34 bytes
756 0x35 bytes
2046276 0x36 bytes
20439 0x37 bytes
55249425 0x38 bytes
551880 0x39 bytes
345947652 0x3A bytes
2916 0x3B bytes
27 0x3C bytes
19656 0x3D bytes
56133 0x3E bytes
40842225 0x3F bytes
1104865839 0x40 bytes
45626405434600949201732247 0x41 bytes
1804396708986926427391243545 0x42 bytes
27 0x43 bytes
75789 0x44 bytes
756 0x45 bytes
2046276 0x46 bytes
20439 0x47 bytes
55249425 0x48 bytes
551880 0x49 bytes
1491734448 0x4A bytes
9355487364 0x4B bytes
78732 0x4C bytes
756 0x4D bytes
530685 0x4E bytes
1515591 0x4F bytes
1102740075 0x50 bytes
29831377653 0x51 bytes
1231912946734225628446770696 0x52 bytes
48718711142647013539563576444 0x53 bytes
2066715 0x54 bytes
55801305 0x55 bytes
1506635235 0x56 bytes
292874988897 0x57 bytes
2125764 0x58 bytes
14348907 0x59 bytes
40920957 0x5A bytes
29773982025 0x5B bytes
33261649561824092773510005450 0x5C bytes
1315405200851469365568216563988 0x5D bytes
55801305 0x5E bytes
1506635235 0x5F bytes
7948303851537 0x60 bytes
57395628 0x61 bytes
387420489 0x62 bytes
1104865839 0x63 bytes
803897514675 0x64 bytes
898064538169250504884770147177 0x65 bytes
35515940422989672870341847227676 0x66 bytes
1506635235 0x67 bytes
40679151345 0x68 bytes
214604203991472 0x69 bytes
1549681956 0x6A bytes
10460353203 0x6B bytes
29831377653 0x6C bytes
24001245795414021635055080475036 0x6D bytes
246496735155742018538946394995 0x6E bytes
958930391420721167499229875147252 0x6F bytes
40679151345 0x70 bytes
5795411844856032 0x71 bytes
41841412812 0x72 bytes
282429536481 0x73 bytes
805447196631 0x74 bytes
648033636476178584146487172825972 0x75 bytes
108 0x76 bytes
6655411849205034500551552664784 0x77 bytes
25891120568359471522479206628975804 0x78 bytes
1098337086315 0x79 bytes
156484875126743748 0x7A bytes
21747074309037 0x7B bytes
17496908184856821771955153666301244 0x7C bytes
108 0x7D bytes
2808 0x7E bytes
27 0x7F bytes
81 0x80 bytes
179696119928535931514891921949087 0x81 bytes
699060255345705731106938578982346708 0x82 bytes
4225121283523411674 0x83 bytes
472416520991134187843376319996477587 0x84 bytes
108 0x85 bytes
2808 0x86 bytes
27 0x87 bytes
75789 0x88 bytes
108 0x89 bytes
729 0x8A bytes
2079 0x8B bytes
27 0x8C bytes
4851795238070470150902081892625349 0x8D bytes
18874626894334054739887341632523361116 0x8E bytes
114078274655132115171 0x8F bytes
12755246066760623071771160639904894849 0x90 bytes
108 0x91 bytes
2808 0x92 bytes
27 0x93 bytes
75789 0x94 bytes
756 0x95 bytes
2046276 0x96 bytes
2916 0x97 bytes
27 0x98 bytes
19656 0x99 bytes
56133 0x9A bytes
130998471427902694074356211100885179 0x9B bytes
854006569949556303994892977044130020645 0x9C bytes
108 0x9D bytes
2808 0x9E bytes
27 0x9F bytes
75789 0xA0 bytes
756 0xA1 bytes
2046276 0xA2 bytes
55269864 0xA3 bytes
78732 0xA4 bytes
756 0xA5 bytes
530685 0xA6 bytes
1515591 0xA7 bytes
3536958728553372740007617699723899860 0xA8 bytes
23058177388638020207862110380191510557388 0xA9 bytes
108 0xAA bytes
2808 0xAB bytes
27 0xAC bytes
75789 0xAD bytes
756 0xAE bytes
2046276 0xAF bytes
20439 0xB0 bytes
55249425 0xB1 bytes
1492286328 0xB2 bytes
2125764 0xB3 bytes
14348907 0xB4 bytes
40920957 0xB5 bytes
622666287378897486676257185943063330345696 0xB6 bytes
108 0xB7 bytes
2808 0xB8 bytes
27 0xB9 bytes
75789 0xBA bytes
756 0xBB bytes
2046276 0xBC bytes
20439 0xBD bytes
55249425 0xBE bytes
1492286328 0xBF bytes
40291730856 0xC0 bytes
57395628 0xC1 bytes
387420489 0xC2 bytes
1104865839 0xC3 bytes
16811989759230232140258944020462709919333792 0xC4 bytes
108 0xC5 bytes
2808 0xC6 bytes
27 0xC7 bytes
75789 0xC8 bytes
756 0xC9 bytes
2046276 0xCA bytes
20439 0xCB bytes
55249425 0xCC bytes
551880 0xCD bytes
1491734448 0xCE bytes
40291730856 0xCF bytes
1087876733112 0xD0 bytes
1549681956 0xD1 bytes
10460353203 0xD2 bytes
29831377653 0xD3 bytes
453923723499216267786991488552493167822012492 0xD4 bytes
2808 0xD5 bytes
27 0xD6 bytes
75789 0xD7 bytes
756 0xD8 bytes
2046276 0xD9 bytes
20439 0xDA bytes
55249425 0xDB bytes
551880 0xDC bytes
1491734448 0xDD bytes
40291730856 0xDE bytes
1087876733112 0xDF bytes
29372671794024 0xE0 bytes
324270949293 0xE1 bytes
805447196631 0xE2 bytes
12255940534478839230248770190917315531194337311 0xE3 bytes
76545 0xE4 bytes
2066715 0xE5 bytes
55801305 0xE6 bytes
1506635235 0xE7 bytes
832318279426764 0xE8 bytes
21747074309037 0xE9 bytes
330910394430928659216716795154767519342247107424 0xEA bytes
2066715 0xEB bytes
55801305 0xEC bytes
1506635235 0xED bytes
22472634223673946 0xEE bytes
8934580649635073798851353469178723609411678244474 0xEF bytes
55801305 0xF0 bytes
1506635235 0xF1 bytes
40679151345 0xF2 bytes
606761124039196515 0xF3 bytes
241233677540146992568986543667825537454115312600825 0xF4 bytes
1506635235 0xF5 bytes
40679151345 0xF6 bytes
6513309293583968799362636679031305893812560835614495 0xF7 bytes
40679151345 0xF8 bytes
1098337086315 0xF9 bytes
175859350926767157582791190333845259132939142561591365 0xFA bytes
1098337086315 0xFB bytes
4748202475022713254735362139013821996589386504264297360 0xFC bytes
29655101330505 0xFD bytes
128201466825613257877854777753373193907913435615136028720 0xFE bytes
3461439604291557962702078999341076235513663562296408699075 0xFF bytes
Each run of identical bytes combined with the previous runs constitutes a prefix, and the full program is all the strings described above concatenated.
This is an optimal score. (The programs print all numbers from -127 to 128 inclusive.)
To create this answer, first, I copied the Java answer here for generating brainfuck programs to print a string. I ran it with this main
function:
public static void main(String args) {
for (int i = -127; i <= 128; ++i) generate(""+i);
}
Then, I ran this Ruby script to generate the human-readable text shown here:
#!/usr/bin/ruby
nums = File.open('f').map do |line|
line.chomp.sub(/^+/, '>+').chars.map{|ch|
'+-><.,'.index(ch).to_s(3).rjust(3,?0)
}.join.to_i 3
end
puts ([0]+nums.sort).each_cons(2).map.with_index{|x,i|"#{x[1]-x[0]} 0x#{i.to_s(16).rjust(2,?0).upcase} bytes"}*"n"
The largest program is 3594571896764310192036774345469579167648804468538578264427 bytes long (and prints -90
).
answered 51 mins ago
Doorknob♦Doorknob
54.6k17114348
54.6k17114348
$begingroup$
Props for the speed and practical problem-solving skill!
$endgroup$
– lirtosiast
38 mins ago
add a comment |
$begingroup$
Props for the speed and practical problem-solving skill!
$endgroup$
– lirtosiast
38 mins ago
$begingroup$
Props for the speed and practical problem-solving skill!
$endgroup$
– lirtosiast
38 mins ago
$begingroup$
Props for the speed and practical problem-solving skill!
$endgroup$
– lirtosiast
38 mins ago
add a comment |
$begingroup$
Python 3, $(6^{3})/12 = 18$
0x1-2+3|True*~4
This is a snippet.
The individual prefix snippets are:
0 # gives 0
0x1 # gives 1 (hex syntax)
0x1-2 # gives -1 (1 minus 2)
0x1-2+3 # gives 2 (-1 plus 3)
0x1-2+3|True # gives 3 (True == 1; 2 bitwise-OR 1 == 3)
0x1-2+3|True*~4 # gives -5 (~4 == -5; True*~4 == -5; 2|-5 == -5)
Python's bitwise operators treat negative integers as two's complement with unlimited 1
s to the right, so -5
is treated as ...11111011
, which when ORed with ...000010
gives ...11111011
unchanged.
$endgroup$
add a comment |
$begingroup$
Python 3, $(6^{3})/12 = 18$
0x1-2+3|True*~4
This is a snippet.
The individual prefix snippets are:
0 # gives 0
0x1 # gives 1 (hex syntax)
0x1-2 # gives -1 (1 minus 2)
0x1-2+3 # gives 2 (-1 plus 3)
0x1-2+3|True # gives 3 (True == 1; 2 bitwise-OR 1 == 3)
0x1-2+3|True*~4 # gives -5 (~4 == -5; True*~4 == -5; 2|-5 == -5)
Python's bitwise operators treat negative integers as two's complement with unlimited 1
s to the right, so -5
is treated as ...11111011
, which when ORed with ...000010
gives ...11111011
unchanged.
$endgroup$
add a comment |
$begingroup$
Python 3, $(6^{3})/12 = 18$
0x1-2+3|True*~4
This is a snippet.
The individual prefix snippets are:
0 # gives 0
0x1 # gives 1 (hex syntax)
0x1-2 # gives -1 (1 minus 2)
0x1-2+3 # gives 2 (-1 plus 3)
0x1-2+3|True # gives 3 (True == 1; 2 bitwise-OR 1 == 3)
0x1-2+3|True*~4 # gives -5 (~4 == -5; True*~4 == -5; 2|-5 == -5)
Python's bitwise operators treat negative integers as two's complement with unlimited 1
s to the right, so -5
is treated as ...11111011
, which when ORed with ...000010
gives ...11111011
unchanged.
$endgroup$
Python 3, $(6^{3})/12 = 18$
0x1-2+3|True*~4
This is a snippet.
The individual prefix snippets are:
0 # gives 0
0x1 # gives 1 (hex syntax)
0x1-2 # gives -1 (1 minus 2)
0x1-2+3 # gives 2 (-1 plus 3)
0x1-2+3|True # gives 3 (True == 1; 2 bitwise-OR 1 == 3)
0x1-2+3|True*~4 # gives -5 (~4 == -5; True*~4 == -5; 2|-5 == -5)
Python's bitwise operators treat negative integers as two's complement with unlimited 1
s to the right, so -5
is treated as ...11111011
, which when ORed with ...000010
gives ...11111011
unchanged.
answered 2 hours ago
pizzapants184pizzapants184
2,674716
2,674716
add a comment |
add a comment |
$begingroup$
Python 2, $11^3/53 = 25.1132075472$
015-8*2+6/3&9%7ifelse 4^ord('b')
Prefixes:
0 # 0
01 # 1
015 # 13 (octal)
015-8 # 5
015-8*2 # -3
015-8*2+6 # 3
015-8*2+6/3 # -1
015-8*2+6/3&9 # 9 (-1 bitwise-AND 9 = 9)
015-8*2+6/3&9%7 # 2
015-8*2+6/3&9%7ifelse 4 # 4
015-8*2+6/3&9%7ifelse 4^ord('b') # 12 (4 bitwise-XOR 8 -- OR would also work)
Not optimal, but the best I could personally find with this particular structure.
$endgroup$
add a comment |
$begingroup$
Python 2, $11^3/53 = 25.1132075472$
015-8*2+6/3&9%7ifelse 4^ord('b')
Prefixes:
0 # 0
01 # 1
015 # 13 (octal)
015-8 # 5
015-8*2 # -3
015-8*2+6 # 3
015-8*2+6/3 # -1
015-8*2+6/3&9 # 9 (-1 bitwise-AND 9 = 9)
015-8*2+6/3&9%7 # 2
015-8*2+6/3&9%7ifelse 4 # 4
015-8*2+6/3&9%7ifelse 4^ord('b') # 12 (4 bitwise-XOR 8 -- OR would also work)
Not optimal, but the best I could personally find with this particular structure.
$endgroup$
add a comment |
$begingroup$
Python 2, $11^3/53 = 25.1132075472$
015-8*2+6/3&9%7ifelse 4^ord('b')
Prefixes:
0 # 0
01 # 1
015 # 13 (octal)
015-8 # 5
015-8*2 # -3
015-8*2+6 # 3
015-8*2+6/3 # -1
015-8*2+6/3&9 # 9 (-1 bitwise-AND 9 = 9)
015-8*2+6/3&9%7 # 2
015-8*2+6/3&9%7ifelse 4 # 4
015-8*2+6/3&9%7ifelse 4^ord('b') # 12 (4 bitwise-XOR 8 -- OR would also work)
Not optimal, but the best I could personally find with this particular structure.
$endgroup$
Python 2, $11^3/53 = 25.1132075472$
015-8*2+6/3&9%7ifelse 4^ord('b')
Prefixes:
0 # 0
01 # 1
015 # 13 (octal)
015-8 # 5
015-8*2 # -3
015-8*2+6 # 3
015-8*2+6/3 # -1
015-8*2+6/3&9 # 9 (-1 bitwise-AND 9 = 9)
015-8*2+6/3&9%7 # 2
015-8*2+6/3&9%7ifelse 4 # 4
015-8*2+6/3&9%7ifelse 4^ord('b') # 12 (4 bitwise-XOR 8 -- OR would also work)
Not optimal, but the best I could personally find with this particular structure.
answered 1 hour ago
Aidan F. PierceAidan F. Pierce
823616
823616
add a comment |
add a comment |
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f179751%2fthe-real-treasure-was-the-numbers-we-made-along-the-way%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
Any chance we could reuse whitespace characters?
$endgroup$
– Shaggy
3 hours ago
$begingroup$
Can we look at out own code cheating-quine style, like with
open(__file__)
in Python?$endgroup$
– xnor
2 hours ago
$begingroup$
The Final submission line appears to have swapped the 3 for a 2 (I haven't edited to correct this in case I've misunderstood)
$endgroup$
– trichoplax
2 hours ago
$begingroup$
It looks to me like you can get a near-optimal score in Python by writing
print 123-len(open(__file__).read())
followed by#
then one of each byte not used so far (except some control characters), with prefixes chopping those bytes. Adjust 123 to whatever centers the range of outputs around 0. For a better score, the non-comment part of the program can be rewritten using only the 7 distinct characters that are universal for Python. Is this all valid?$endgroup$
– xnor
2 hours ago
1
$begingroup$
@JoKing I do include negatives, when the difference is negative.
$endgroup$
– xnor
2 hours ago