187
\$\begingroup\$

I think the question as above is clear, but just in case:

  • Write a full program (not just a function) which prints a positive base 10 integer, optionally followed by a single newline.

  • Qualifying programs will be those whose output is longer (in bytes) than the source code of the program, measured in bytes (assuming ASCII or UTF-8 encoding for the program source code).

    I.e. the code must be shorter than the number of digits in the resulting number.

  • Leading zeros are disallowed under all circumstances. Counting leading zeroes trivialises the problem; ignoring leading zeros unnecessarily complicates the question.

  • The winning program will be the qualifying program which prints the integer with the smallest magnitude.

Leaderboard snippet

var QUESTION_ID = 67921;
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe"; var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;
function answersUrl(index) { return "https://api.stackexchange.com/2.2/questions/" + QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER; }
function commentUrl(index, answers) { return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER; }
function getAnswers() { jQuery.ajax({ url: answersUrl(answer_page++), method: "get", dataType: "jsonp", crossDomain: true, success: function (data) { answers.push.apply(answers, data.items); answers_hash = []; answer_ids = []; data.items.forEach(function(a) { a.comments = []; var id = +a.share_link.match(/\d+/); answer_ids.push(id); answers_hash[id] = a; }); if (!data.has_more) more_answers = false; comment_page = 1; getComments(); } }); } function getComments() { jQuery.ajax({ url: commentUrl(comment_page++, answer_ids), method: "get", dataType: "jsonp", crossDomain: true, success: function (data) { if (data.has_more) getComments(); else if (more_answers) getAnswers(); else process(); } }); }
getAnswers();
var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*)(?:,|[-\u2013] ).*?([\d,^!e+]+)(?=\:?[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;
var OVERRIDE_REG = /^Override\s*header:\s*/i;
function getAuthorName(a) { return a.owner.display_name; }
function process() { var valid = []; answers.forEach(function(a) { var body = a.body; a.comments.forEach(function(c) { if(OVERRIDE_REG.test(c.body)) body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>'; }); var match = body.replace(/<sup>([^\n<]*)<\/sup>/g, "^$1").replace(/\(\d+(?:\^\d+,)? [\w\s]+\)/g, "").replace(/floor\(10\^(\d+)\/9\)/g, "$1 ones").replace(/(\d+) ones/g, function (_, x) { return Array(+x + 1).join(1); }).match(SCORE_REG); if (match) valid.push({ user: getAuthorName(a), size: +match[2].replace(/,/g, "").replace(/(\d+)\s*\^\s*(\d+)/, function (_, a, b) { return Math.pow(a, b); }).replace(/(\d+)!/, function (_, n) { for (var i = 1, j = 1; i <= n; i++) j *= i; return j; }), language: match[1], link: a.share_link, }); else console.log(body); }); valid.sort(function (a, b) { var aB = a.size, bB = b.size; return aB - bB }); var languages = {}; var place = 1; var lastSize = null; var lastPlace = 1; valid.forEach(function (a) { if (a.size != lastSize) lastPlace = place; lastSize = a.size; ++place; var answer = jQuery("#answer-template").html(); answer = answer.replace("{{PLACE}}", lastPlace + ".") .replace("{{NAME}}", a.user) .replace("{{LANGUAGE}}", a.language) .replace("{{SIZE}}", a.size) .replace("{{LINK}}", a.link); answer = jQuery(answer); jQuery("#answers").append(answer); var lang = a.language; lang = jQuery('<a>'+lang+'</a>').text(); languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang.toLowerCase(), user: a.user, size: a.size, link: a.link}; }); var langs = []; for (var lang in languages) if (languages.hasOwnProperty(lang)) langs.push(languages[lang]); langs.sort(function (a, b) { if (a.lang_raw > b.lang_raw) return 1; if (a.lang_raw < b.lang_raw) return -1; return 0; }); for (var i = 0; i < langs.length; ++i) { var language = jQuery("#language-template").html(); var lang = langs[i]; language = language.replace("{{LANGUAGE}}", lang.lang) .replace("{{NAME}}", lang.user) .replace("{{SIZE}}", lang.size) .replace("{{LINK}}", lang.link); language = jQuery(language); jQuery("#languages").append(language); } }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<style>body { text-align: left !important} #answer-list { padding: 10px; width: 290px; float: left; } #language-list { padding: 10px; width: 290px; float: left; } table thead { font-weight: bold; } table td { padding: 5px; }</style>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> 
<div id="language-list"> <h2>Shortest Solution by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr> </thead> <tbody id="languages"> </tbody> </table> </div> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr> </thead> <tbody id="answers"> </tbody> </table> </div> <table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table>

\$\endgroup\$
22
  • 65
    \$\begingroup\$ Number 1 on the Hot Network Questions. Not bad for a first question... \$\endgroup\$
    – trichoplax
    Dec 28 '15 at 15:15
  • 7
    \$\begingroup\$ @Kslkgh Strictly less than, otherwise the question is trivial for programs which implicitly print their last value. \$\endgroup\$
    – Arandur
    Dec 28 '15 at 15:57
  • 7
    \$\begingroup\$ Is 1.0 an integer? \$\endgroup\$
    – histocrat
    Dec 28 '15 at 20:05
  • 30
    \$\begingroup\$ The restriction to UTF-8 is ridiculous and detrimental. Bytes are bytes, no matter the encoding. I strongly recommend that you change the rules, as as they currently are they disallow languages that are not character-based (e.g. Minecraft, Piet, Folders) or have longer UTF-8 byte counts than their "real" (valid according to this question) byte counts (e.g. APL, TI-BASIC, Seriously, Jelly). \$\endgroup\$
    – lirtosiast
    Dec 29 '15 at 3:35
  • 7
    \$\begingroup\$ @ZachGates that's not how the HNQ list works. ;) \$\endgroup\$ Dec 29 '15 at 8:38

159 Answers 159

1
2 3 4 5 6
203
\$\begingroup\$

Retina, score 1


The empty program counts the number of matches of the empty regex in the input (which is the empty string). That's exactly 1 match, so it prints 1.

Try it online.

\$\endgroup\$
10
  • 41
    \$\begingroup\$ ... WE HAVE A WINNER. \$\endgroup\$
    – Arandur
    Dec 28 '15 at 15:11
  • 10
    \$\begingroup\$ Just btw, I'd say the number of matches is infinite. The empty string can repeat an unlimited number of times and be matched infinitely. \$\endgroup\$
    – nicael
    Dec 28 '15 at 15:19
  • 55
    \$\begingroup\$ @nicael Luckily, that's not how regex works. ;) \$\endgroup\$ Dec 28 '15 at 15:19
  • 8
    \$\begingroup\$ @MartinBüttner that depends on your regex engine. I've definitely encountered systems that will crap out if you ever try to match the empty string. \$\endgroup\$
    – Sparr
    Dec 28 '15 at 16:30
  • 22
    \$\begingroup\$ @LorenPechtel that rule applies only to quine challenges where the empty program is trivially a solution in most languages. I think it's fair game here, since this empty program actually has non-trivial semantics and Retina does not have this behaviour because of challenges like this but because it's the only consistent generalisation of its behaviour for all single-line programs. \$\endgroup\$ Dec 30 '15 at 7:27
76
\$\begingroup\$

Pyth, 10

T

First attempt at using Pyth. Having had the question clarified, it seems 10 will be the smallest number. In Pyth the letter T starts off as the number 10, so this simply prints 10 which is larger than the length of the source code. You can try it here.

\$\endgroup\$
3
  • 104
    \$\begingroup\$ I like how your first attempt at using Pyth is just the letter T. \$\endgroup\$
    – djechlin
    Dec 28 '15 at 15:34
  • 8
    \$\begingroup\$ Well, I thought this would be the most readable Pyth program I'd see for a while, but this is impressively easy to understand. \$\endgroup\$
    – Deusovi
    Dec 30 '15 at 7:41
  • 2
    \$\begingroup\$ This is a polygot, this works in 05AB1E too. 05ab1e.tryitonline.net/#code=VA \$\endgroup\$ Oct 24 '16 at 16:46
60
\$\begingroup\$

bc, 10

A

Luckily, bc prints the result of the last expression by default. A is interpreted as a hex digit, so results in 10.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ But there're already (at least) 5 similar answers, including the solution with A, because many golfing languages are defining A as 10. \$\endgroup\$
    – nicael
    Dec 28 '15 at 18:42
  • 45
    \$\begingroup\$ @nicael Yes, that's true. I claim this answer is different because bc is not a golfing language. It is in fact a Posix-defined language available by default on just about any standard *nix system you can find. \$\endgroup\$ Dec 28 '15 at 18:45
48
\$\begingroup\$

Fishing, score 7,958,661,109,946,400,884,391,936 1,208,925,819,614,629,174,706,176

Is this the highest non-trivial-looking score ever in a minimization challenge? (Even though it has been golfed by 84.8%)

v+CCCCCCCCCC
  `32`nSSSSP

Explanation

v              Sets the casting direction to down
 +             Increments the casting distance by 1
  CCCCCCCCCC   Casts the rod

`32`         Pushes a string "32" to the stack
    n        Converts the stack from a string to an integer
     SSSS    Repeated squaring of the stack
         P   Prints the stack

The number is 32^16 and has 25 digits. The code is 24 bytes long. The previous answer was 6^32.

\$\endgroup\$
8
  • 2
    \$\begingroup\$ Brought a tear to my eye. Thank you for your contribution. \$\endgroup\$
    – Arandur
    Dec 28 '15 at 14:53
  • 34
    \$\begingroup\$ It will probably still beat Java... Hopefully. \$\endgroup\$
    – Arcturus
    Dec 28 '15 at 14:53
  • 3
    \$\begingroup\$ Well, it beats C#... \$\endgroup\$ Dec 28 '15 at 15:52
  • \$\begingroup\$ Why 6 and not 9? \$\endgroup\$
    – user253751
    Dec 30 '15 at 2:10
  • \$\begingroup\$ @immibis The goal of the challenge is to minimize the score, so it's not just minimizing bytes; putting 9 before would have increased my score unnecessarily. \$\endgroup\$
    – Arcturus
    Dec 30 '15 at 2:59
37
\$\begingroup\$

MATLAB, 1,000,000,000 (109)

Also works with Octave

disp(1e9)

Never going to beat the esolangs, but just for fun, this is the smallest MATLAB/Octave will be able to do, so thought I would post it anyway.

\$\endgroup\$
6
  • 19
    \$\begingroup\$ The esolang answers, while valid, are kinda boring. Glad to see one that isn't! \$\endgroup\$
    – Arandur
    Dec 28 '15 at 14:50
  • 1
    \$\begingroup\$ perl say 1e9 is slightly shorter, if you want to improve your golf score. (Though it's nowhere near the smaller integer for which this approach works...) \$\endgroup\$
    – derobert
    Jan 3 '16 at 7:23
  • \$\begingroup\$ @derobert True. 1e1 would satisfy the problem statement and give a score of 10 (the lower, the better) (Assuming a char is 1 byte) \$\endgroup\$
    – dberm22
    Jan 5 '16 at 13:18
  • \$\begingroup\$ @dberm22 10 (2 characters) is not longer than 1e1 (3 characters) \$\endgroup\$ Jan 5 '16 at 14:05
  • \$\begingroup\$ @SuperJedi224 Ahh, I read it as the magnitude of the printed number has to be larger than the bytecount, not the number of digits in the printed number. Thanks for the clarification. \$\endgroup\$
    – dberm22
    Jan 5 '16 at 15:36
29
\$\begingroup\$

TI-84 BASIC, 120

5!

ᴇ2 would score better if not for the silly UTF-8 requirement. (It's only two bytes in the calculator's native tokenized encoding, but it's 4 in UTF-8...)

\$\endgroup\$
9
  • \$\begingroup\$ Maybe I’m missing something, but the string "E2" is only two bytes in UTF-8… \$\endgroup\$
    – jbg
    Dec 30 '15 at 9:10
  • 11
    \$\begingroup\$ @JasperBryant-Greene and E are not the same character. In TI-BASIC, is scientific notation and E is a variable. \$\endgroup\$ Dec 30 '15 at 13:14
  • 4
    \$\begingroup\$ Thanks :) I should have noticed that the character was subtly-smaller-than-full-height… \$\endgroup\$
    – jbg
    Dec 30 '15 at 13:27
  • \$\begingroup\$ Wouldn't 3! score better? \$\endgroup\$
    – dberm22
    Jan 5 '16 at 13:23
  • 1
    \$\begingroup\$ @NobodyNada This time the question specifically said to score in UTF8, for some reason. \$\endgroup\$ May 8 '16 at 11:11
26
\$\begingroup\$

Hexagony, score 100100

Code:

d!!@

In a more readable form:

  d !
 ! @ .
  . .

The char value of d is 100. This will simply print the char value twice and terminates after.

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Cute! Thank you for your contribution. \$\endgroup\$
    – Arandur
    Dec 28 '15 at 15:12
  • 23
    \$\begingroup\$ More readable form? Really? xD \$\endgroup\$
    – RK.
    Jan 3 '16 at 2:34
26
\$\begingroup\$

C#, score 10^72 10^70 10^64 10^63

class A{static void Main(){System.Console.Write($"1{0:D63}");}}

That's 1,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000. I guess that I tried...

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Stunning, really. \$\endgroup\$
    – Arandur
    Dec 28 '15 at 15:46
  • 5
    \$\begingroup\$ Wouldn't Write(new string('1',70)) be better? \$\endgroup\$
    – Lynn
    Dec 28 '15 at 18:02
  • 1
    \$\begingroup\$ You can write it out as a double rather than a string, which shortens it to 10^56 : class A{static void Main(){System.Console.Write(1e56);}} \$\endgroup\$
    – goric
    Dec 30 '15 at 17:00
  • \$\begingroup\$ @goric That just outputs 1E+56. \$\endgroup\$ Dec 30 '15 at 17:50
18
\$\begingroup\$

JavaScript, score 100,000,000,000 (or 1*1011)

alert(1e11)

This is if using alert. Though you can get 100 000 000 times lesser score if using console:

1e3

Score 1000 as you can see, I'm not sure it counts using the console though.

\$\endgroup\$
4
  • \$\begingroup\$ I don't know why it wouldn't count! \$\endgroup\$
    – Arandur
    Dec 28 '15 at 14:49
  • 6
    \$\begingroup\$ @Arandur I'm guessing "I'm not sure it counts" refers to the lower score of 1000, since that requires using the console as a REPL, rather than being a full program. \$\endgroup\$
    – trichoplax
    Dec 28 '15 at 14:52
  • \$\begingroup\$ @tri exactly, made a clarification. \$\endgroup\$
    – nicael
    Dec 28 '15 at 14:53
  • 11
    \$\begingroup\$ +1 for alert, I would not allow the automatic console output \$\endgroup\$
    – edc65
    Dec 28 '15 at 14:58
17
\$\begingroup\$

PlatyPar, 59

#

# starts a numeric base-60 literal, and since no digits are found, it ends up as 59. This started as a happy accident, but since I have already [ab]used this bug in another answer, I kept it.

Try it online!

Here's another approach, my take on the boring way that everyone and their grandmother used for this challenge.

PlatyPar, 100000000 (9 digits)

'18Md0+;

Explanation

'1        ## push "1" (a string) to the stack
  8Md  ;  ## repeat 8 times
     0+    ## add a 0
          ## [implicitly] print the result

Try it online!

\$\endgroup\$
16
\$\begingroup\$

Brainf**k, 11111111111111111111111111111111111 (~1e34)

And another reduction:

+++++++[>+++++++>+<<-]>>[<.....>-]

Which gives 35 consecutive 1's, or approximately 1e34.


A bit smaller still

++++++++[>++++++>+<<-]>+>+[<....>-]

Gives 36 1's which is a number about 11% larger than 1e35.


Thanks to @Martin Büttner for knocking off a couple of characters reducing the total output by a factor of 100 with this code (yields 1e36):

++++++[>++++++++>++<<-]>+.->[<...>-]

My old code (yields 1+e38):

++++++++[>++++++>++<<-]>+.->+++[<..>-]

I've been experimenting with esolangs out of boredom. This is the best I could do in BF. I wonder if it is possible to make it smaller?

You can try it online here.

\$\endgroup\$
2
  • \$\begingroup\$ I wrote a shorter answer, from scratch: link \$\endgroup\$
    – Lynn
    Dec 30 '15 at 12:27
  • \$\begingroup\$ @Mauris impressive! \$\endgroup\$ Dec 30 '15 at 13:15
16
\$\begingroup\$

C, 1000000000000000000000000000 (28 digits)

main(){printf("1%027d",0);}

Similar to my C++ answer, without the #include <stdio.h> (Ignore the warning about missing declaration of printf. Thanks @Dennis)

Newline would require an additional 2 bytes, using format 1%029d\n

\$\endgroup\$
14
\$\begingroup\$

Japt, score 10

A

As shows the score, prints 10.

\$\endgroup\$
8
  • \$\begingroup\$ This is not code golf;the goal is to print the smallest number, your score is 10. \$\endgroup\$ Dec 28 '15 at 14:26
  • \$\begingroup\$ @ppp "The number must be longer in bytes than the program -- have more digits than the code has characters" - OP's just edited. \$\endgroup\$
    – nicael
    Dec 28 '15 at 14:32
  • 2
    \$\begingroup\$ You have not misunderstood; if the Japt program A prints 10, then this is a valid program with a score of 10. \$\endgroup\$
    – Arandur
    Dec 28 '15 at 14:34
  • 3
    \$\begingroup\$ Woohoo, my language is tied for <s>first</s> second place! glares at Retina \$\endgroup\$ Dec 28 '15 at 16:21
  • 4
    \$\begingroup\$ Any reason for downvote? \$\endgroup\$
    – nicael
    Dec 28 '15 at 19:14
12
\$\begingroup\$

Python 2, 101010101010

print'10'*6
\$\endgroup\$
0
10
\$\begingroup\$

PHP, score 10,000,000

<?=1e7;

This prints 10000000 as can be seen there.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Since the OP asked for the smallest integer, why did you pick an exponent of seven? Does it print without commas? \$\endgroup\$
    – WGroleau
    Dec 29 '15 at 4:51
  • \$\begingroup\$ @WGroleau it does print without any commas, justachat.freevar.com/test.php \$\endgroup\$
    – nicael
    Dec 29 '15 at 6:28
9
\$\begingroup\$

Labyrinth, score 10,000,000

1!!!!>@

It might be possible to bring this down by one order of magnitude, but I can't find anything right now.

The first 1!!!! prints 1000. Then > shifts the source code to

@1!!!!>

which avoids early termination. Then the IP hits a dead end and turns around. Now !!!! prints four more zeroes and @ terminates the program.

Try it online.

\$\endgroup\$
9
\$\begingroup\$

Samau, 42

A

A pushes the Answer to the Ultimate Question of Life, The Universe, and Everything onto the stack. Then the top of the stack is automatically printed.

\$\endgroup\$
3
  • \$\begingroup\$ I think something is wrong with your commit messages :P \$\endgroup\$
    – Doorknob
    Jan 3 '16 at 7:23
  • 4
    \$\begingroup\$ @Doorknob冰 I don't know how to write commit messages, so I just use random emojis. \$\endgroup\$
    – alephalpha
    Jan 3 '16 at 9:17
  • 7
    \$\begingroup\$ Ok, here's the real question: what does Q push? \$\endgroup\$
    – Cyoce
    Mar 8 '16 at 15:20
9
\$\begingroup\$

Brainfuck, 3333333333333333333333333 (25 threes)

This is written "from scratch" so I think it's okay to post a separate answer:

-[>+>+<<-----]>-[-->.<]

23 bytes long.

\$\endgroup\$
3
  • \$\begingroup\$ I was considering a bf solution, are there any current interpreters that only output as numbers? \$\endgroup\$ May 5 '17 at 23:21
  • \$\begingroup\$ @RohanJhunjhunwala this outputs 51 (the ASCII code for "3") 25 times. \$\endgroup\$ May 6 '17 at 2:16
  • \$\begingroup\$ @LevelRiverSt what Im saying is that there might exist a bf interpreter that doesn't input as ascii and only does integer output, thus (-.) would output 255. \$\endgroup\$ May 6 '17 at 2:32
9
\$\begingroup\$

DC, 10000

4 chars program:

I4^f

5 digits output:

$ dc<<<'I4^f'
10000
\$\endgroup\$
2
  • 3
    \$\begingroup\$ +1. Yep, I think that's optimal in dc. Unusually bc is shorter. \$\endgroup\$ Dec 28 '15 at 19:00
  • \$\begingroup\$ I thought I was doing well with 6d^p (yielding 46656), but you have that beat - well done! \$\endgroup\$ Jan 6 '16 at 17:19
8
\$\begingroup\$

Vitsy, 7! = 5040

7FN

Outputs 5040.

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Why not 3FN outputting 6? \$\endgroup\$ Mar 25 '16 at 7:42
  • \$\begingroup\$ @PeterTaylor The number has to be greater in length, not greater in magnitude. \$\endgroup\$ Mar 26 '16 at 13:29
8
\$\begingroup\$

C, 11111111111111111111111111111111111 (35 ones)

main(c){while(c++<36)putchar(49);}

Maybe there's a shorter way. The lack of a simple way to print big numbers in C makes it tricky.

\$\endgroup\$
0
7
\$\begingroup\$

CJam, score 10

A

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Why not Y, score 2? \$\endgroup\$ Mar 25 '16 at 7:43
  • 2
    \$\begingroup\$ Because 2 is only one character, so it isn't longer than the source code. \$\endgroup\$
    – Dennis
    Mar 25 '16 at 12:48
7
\$\begingroup\$

Java, 111111111111111111111111111111111111111111111111111111111111111111111111111111111 (81 ones)

interface A{static void main(String[]a){for(A i:new A[81])System.out.print(1);}}
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I've underlined the part that is actually "variable" here; everything else is absolutely necessary for a working Java program.

Presumably this is shorter than mucking around with Java's BigInteger.

\$\endgroup\$
7
  • \$\begingroup\$ Presumably ... - perhaps System.out.print(BigInteger.TEN.pow(10)); - is that one character less? Sorry - nowhere near big enough - and .pow(10).pow(10) is longer. \$\endgroup\$ Dec 29 '15 at 13:31
  • \$\begingroup\$ You can replace interface with class. \$\endgroup\$ Dec 30 '15 at 11:46
  • 2
    \$\begingroup\$ But then main would need to be public. \$\endgroup\$
    – Lynn
    Dec 30 '15 at 12:01
  • 7
    \$\begingroup\$ you can shave off 2 characters by doing this for the for loop: for(A a:new A[81]) \$\endgroup\$
    – Jack Ammo
    Jan 1 '16 at 21:48
  • \$\begingroup\$ @OldCurmudgeon Would .pow(100) not work for some reason? \$\endgroup\$ Mar 16 '16 at 15:50
7
\$\begingroup\$

Cubix, 100100

@'dOu

Cubix is a 2-dimensional, stack-based esolang. Cubix is different from other 2D langs in that the source code is wrapped around the outside of a cube.

Test it online!

Explanation

The first thing the interpreter does is figure out the smallest cube that the code will fit onto. In this case, the edge-length is 1. Then the code is padded with no-ops . until all six sides are filled. Whitespace is removed before processing, so this code is identical to the above:

  @
' d O u
  .

Now the code is run. The IP (instruction pointer) starts out on the far left face, pointing east.

The first char the IP encounters is ', which pushes the next byte onto the stack; this byte is d, or 100. Next is O, which outputs the top item (100) as an integer.

Then the IP hits u, which turns it to the right, moves it forward, then turns it again. It switches to the bottom face pointing north, then rotates to the east. This wraps it to the O again, outputting 100, then up to @ which terminates the program.

\$\endgroup\$
6
\$\begingroup\$

Jelly, score 120

5!

Calculates the factorial of 5. Try it online!

\$\endgroup\$
3
  • 2
    \$\begingroup\$ It specifies that the text encoding should be UTF-8 - is that followed here? \$\endgroup\$ Dec 28 '15 at 14:58
  • 2
    \$\begingroup\$ I was going to say -- this might be the first esolang that actually can't trivially answer this question. \$\endgroup\$
    – Arandur
    Dec 28 '15 at 14:59
  • 1
    \$\begingroup\$ @FlagAsSpam I missed that unusual rule. It's fixed now. \$\endgroup\$
    – Dennis
    Dec 28 '15 at 15:27
6
\$\begingroup\$

MATL, 1000

1e3

Note: latest GitHub commit of the compiler works on Octave as well as on Matlab.

This interprets the number in scientific notation, and implicitly prints it, thus producing the output

1000

\$\endgroup\$
6
\$\begingroup\$

Perl, 1000000000

print 1e9

Straightforward.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Can't you reduce your score by using say? \$\endgroup\$
    – Neil
    Dec 29 '15 at 23:10
  • \$\begingroup\$ That would require enabling the -E flag, I suppose. I'm not sure how to count that, in this challenge. \$\endgroup\$
    – Lynn
    Dec 30 '15 at 1:16
  • 1
    \$\begingroup\$ Since "-M5.010, when needed, is free," you shouldn't have to count it at all. \$\endgroup\$ Dec 30 '15 at 20:47
6
\$\begingroup\$

Python 2, 107918163081

print 69**6
\$\endgroup\$
4
  • \$\begingroup\$ You can remove the space between print and the 2. \$\endgroup\$
    – Bakuriu
    Dec 29 '15 at 19:40
  • 1
    \$\begingroup\$ @Bakuriu No you can't \$\endgroup\$
    – Blue
    Dec 29 '15 at 20:24
  • \$\begingroup\$ 69**6 is only 107918163081. \$\endgroup\$
    – Neil
    Dec 29 '15 at 23:15
  • 2
    \$\begingroup\$ Interstingly enough, this also works in Perl. \$\endgroup\$
    – Grimmy
    Jan 4 '16 at 16:17
6
\$\begingroup\$

C++, 1e46

#include <stdio.h>
main(){printf("1%046d",0);}

Newline would require an additional 2 bytes, using format "1%048d\n"

\$\endgroup\$
1
  • \$\begingroup\$ I don't think C++ allows you to omit the return type of main(). OTOH, this would make a good C answer... \$\endgroup\$ Mar 12 '18 at 11:01
5
\$\begingroup\$

O, 10

A

Apparently the score is the number we print!

\$\endgroup\$
0
1
2 3 4 5 6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.