What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?

172

17

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>

Arandur

Posted 2015-12-28T14:14:40.930

Reputation: 982

60

Number 1 on the Hot Network Questions. Not bad for a first question...

– trichoplax – 2015-12-28T15:15:58.930

Are you saying &lt;= the number or &lt; the number? From reading the question, I guess &lt;, but just in case. – JimBobOH – 2015-12-28T15:55:47.107

6@Kslkgh Strictly less than, otherwise the question is trivial for programs which implicitly print their last value. – Arandur – 2015-12-28T15:57:24.293

1Too bad Forth doesn't have an exponentiation operator. 8 8 ^ . Seven bytes; would print an eight digit number—but it would take a lot of bytes to define ^ – WGroleau – 2015-12-28T16:14:30.420

In 7, an esolang I made up a while ago but never implemented, the empty program would print 7. Of course, there's more reason to that than just "because I wanted it to", but it would be a little long to explain here... – ETHproductions – 2015-12-28T18:51:16.563

5Is 1.0 an integer? – histocrat – 2015-12-28T20:05:13.157

It's too late now, but future challenges like this might do well to ask for scores stated as log10(number) – Sparr – 2015-12-28T21:19:42.337

@WGroleau works fine in dc (see my answer below). – Aaron Davies – 2015-12-28T21:32:18.343

Integer? Bother. If it were floating-point, Commodore Basic: 1?π – Mark – 2015-12-28T21:39:13.293

2Every Hot Network Question was number 1 at one point :P @trichoplax – Zach Gates – 2015-12-29T01:58:30.183

19

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).

– lirtosiast – 2015-12-29T03:35:44.383

7@ZachGates that's not how the HNQ list works. ;) – Martin Ender – 2015-12-29T08:38:03.347

@ZachGates Hot Network Questions is sorted by how many "arbitrary hotness points" a question is assigned. This means most questions never get to the top. This question reached over 200 hotness points at one point, keeping all other questions across the network off the number 1 spot. – trichoplax – 2015-12-29T14:12:44.340

4@trichoplax I saw it at 367 hotness points at one point, beating everything else I've ever seen (except "Hello, World!" and The Programming Language Quiz). – ETHproductions – 2015-12-29T20:32:19.307

I spent some time looking for a language that would somehow print "1" given the empty program. (Or "0", but I'm not sure that counts.) I couldn't find one, but perhaps it's out there? If anybody else knows a language, feel free to take the idea. – David Z – 2015-12-31T14:55:34.913

2@DavidZ See the Retina answer. – Martin Ender – 2016-01-01T16:36:34.427

@Martin ah, there it is. I guess it must have been buried near the bottom when I commented, or else I really really can't read :-P because I definitely didn't see it before. – David Z – 2016-01-01T17:52:19.047

This challenge is very clever in that basically any language can participate. IMHO, it should be a standard "first program" like "Hello, World!" and FizzBuzz. – ETHproductions – 2016-03-16T18:04:57.143

Ok, but why is the question body and the title inconsistent? – CalculatorFeline – 2016-04-07T23:27:48.797

1I like how this user gained all 766 rep from this one question... Nice question. – HyperNeutrino – 2017-01-17T02:17:20.190

That leaderboard snippet is very broken. – 12Me21 – 2017-10-19T15:28:41.560

Answers

186

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.

Martin Ender

Posted 2015-12-28T14:14:40.930

Reputation: 162 549

37... WE HAVE A WINNER. – Arandur – 2015-12-28T15:11:04.010

7Just btw, I'd say the number of matches is infinite. The empty string can repeat an unlimited number of times and be matched infinitely. – nicael – 2015-12-28T15:19:15.743

47@nicael Luckily, that's not how regex works. ;) – Martin Ender – 2015-12-28T15:19:46.920

8@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. – Sparr – 2015-12-28T16:30:42.740

3@Sparr Most of the more common flavours can handle empty matches and treat them such that no two matches can start at the same index, but two can end at the same index (so there can be an empty match at the end of a non-empty one, but not at the beginning of a non-empty one and also no two empty matches in the same position). – Martin Ender – 2015-12-28T16:34:16.037

1I knew this had to be possible in some language... but it never even crossed my mind that that language could be Retina. +1 – ETHproductions – 2015-12-28T16:45:23.513

1@nicael it depends on how you define matches and the number of matches. You could easily provide a definition that doesn't allow to have multiple matches at the same position, which is what is usually done. – Bakuriu – 2015-12-29T19:37:14.490

3I thought null programs weren't allowed in these challenges? – Loren Pechtel – 2015-12-30T03:26:22.220

19@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. – Martin Ender – 2015-12-30T07:27:15.353

1Holy cow, a 0. You beautiful genius. – ricdesi – 2016-02-24T17:19:29.197

71

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.

Tom Carpenter

Posted 2015-12-28T14:14:40.930

Reputation: 3 630

93I like how your first attempt at using Pyth is just the letter T. – djechlin – 2015-12-28T15:34:58.453

7

Well, I thought this would be the most readable Pyth program I'd see for a while, but this is impressively easy to understand.

– Deusovi – 2015-12-30T07:41:09.857

1

This is a polygot, this works in 05AB1E too. http://05ab1e.tryitonline.net/#code=VA

– Magic Octopus Urn – 2016-10-24T16:46:50.660

59

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.

Digital Trauma

Posted 2015-12-28T14:14:40.930

Reputation: 55 069

1But there're already (at least) 5 similar answers, including the solution with A, because many golfing languages are defining A as 10. – nicael – 2015-12-28T18:42:25.107

44

@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.

– Digital Trauma – 2015-12-28T18:45:34.803

46

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.

Arcturus

Posted 2015-12-28T14:14:40.930

Reputation: 3 500

1Brought a tear to my eye. Thank you for your contribution. – Arandur – 2015-12-28T14:53:06.307

25It will probably still beat Java... Hopefully. – Arcturus – 2015-12-28T14:53:35.543

2Well, it beats C#... – LegionMammal978 – 2015-12-28T15:52:53.993

Why 6 and not 9? – immibis – 2015-12-30T02:10:37.763

@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. – Arcturus – 2015-12-30T02:59:47.583

But the number needs to have MORE digits than the size of the code. – SuperJedi224 – 2015-12-30T13:18:54.220

@SuperJedi224 Corrected. – Arcturus – 2015-12-30T14:51:25.857

Link to this language? – MD XF – 2017-09-19T23:10:26.853

34

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.

Tom Carpenter

Posted 2015-12-28T14:14:40.930

Reputation: 3 630

18The esolang answers, while valid, are kinda boring. Glad to see one that isn't! – Arandur – 2015-12-28T14:50:25.147

1perl 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...) – derobert – 2016-01-03T07:23:35.633

@derobert True. 1e1 would satisfy the problem statement and give a score of 10 (the lower, the better) (Assuming a char is 1 byte) – dberm22 – 2016-01-05T13:18:15.687

@dberm22 10 (2 characters) is not longer than 1e1 (3 characters) – SuperJedi224 – 2016-01-05T14:05:25.573

@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. – dberm22 – 2016-01-05T15:36:59.007

Wouldn't disp 1e8 work? I can't test at the moment but I don't recall MATLAB requiring parentheses for disp. Edit Oh nevermind, that just prints it as a string. – Patrick Roberts – 2016-06-17T20:11:40.150

29

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...)

SuperJedi224

Posted 2015-12-28T14:14:40.930

Reputation: 9 433

Maybe I’m missing something, but the string "E2" is only two bytes in UTF-8… – jbg – 2015-12-30T09:10:25.710

11@JasperBryant-Greene and E are not the same character. In TI-BASIC, is scientific notation and E is a variable. – SuperJedi224 – 2015-12-30T13:14:16.287

4Thanks :) I should have noticed that the character was subtly-smaller-than-full-height… – jbg – 2015-12-30T13:27:22.400

Wouldn't 3! score better? – dberm22 – 2016-01-05T13:23:52.883

@dberm22 3! has only 1 digit, we need at least 3. – SuperJedi224 – 2016-01-05T14:04:02.323

@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. – dberm22 – 2016-01-05T15:37:39.653

Can't ᴇ2 count as two bytes since the calculator's encoding isn't UTF-8, like Jelly? – NobodyNada – 2016-05-08T04:15:12.113

@NobodyNada This time the question specifically said to score in UTF8, for some reason. – SuperJedi224 – 2016-05-08T11:11:12.257

Oops, I misread that to say "this rule applies if your code is in ASCII or UTF-8." – NobodyNada – 2016-05-08T14:16:25.457

25

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...

LegionMammal978

Posted 2015-12-28T14:14:40.930

Reputation: 14 318

1Stunning, really. – Arandur – 2015-12-28T15:46:19.080

4Wouldn't Write(new string('1',70)) be better? – Lynn – 2015-12-28T18:02:01.287

1You 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);}} – goric – 2015-12-30T17:00:13.650

@goric That just outputs 1E+56. – LegionMammal978 – 2015-12-30T17:50:38.950

20

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!

Adnan

Posted 2015-12-28T14:14:40.930

Reputation: 33 457

Cute! Thank you for your contribution. – Arandur – 2015-12-28T15:12:00.353

17More readable form? Really? xD – RK. – 2016-01-03T02:34:53.260

17

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.

nicael

Posted 2015-12-28T14:14:40.930

Reputation: 3 022

I don't know why it wouldn't count! – Arandur – 2015-12-28T14:49:17.113

6@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. – trichoplax – 2015-12-28T14:52:05.150

@tri exactly, made a clarification. – nicael – 2015-12-28T14:53:48.243

11+1 for alert, I would not allow the automatic console output – edc65 – 2015-12-28T14:58:26.757

17

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!

Cyoce

Posted 2015-12-28T14:14:40.930

Reputation: 2 273

16

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

Glenn Randers-Pehrson

Posted 2015-12-28T14:14:40.930

Reputation: 1 837

14

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.

Tom Carpenter

Posted 2015-12-28T14:14:40.930

Reputation: 3 630

I wrote a shorter answer, from scratch: link

– Lynn – 2015-12-30T12:27:14.660

@Mauris impressive! – Tom Carpenter – 2015-12-30T13:15:47.230

13

Japt, score 10

A

As shows the score, prints 10.

nicael

Posted 2015-12-28T14:14:40.930

Reputation: 3 022

This is not code golf;the goal is to print the smallest number, your score is 10. – ppperry – 2015-12-28T14:26:02.633

@ppp "The number must be longer in bytes than the program -- have more digits than the code has characters" - OP's just edited. – nicael – 2015-12-28T14:32:47.730

1You have not misunderstood; if the Japt program A prints 10, then this is a valid program with a score of 10. – Arandur – 2015-12-28T14:34:48.927

3Woohoo, my language is tied for <s>first</s> second place! glares at Retina – ETHproductions – 2015-12-28T16:21:20.943

4Any reason for downvote? – nicael – 2015-12-28T19:14:18.237

I think the shortest program that doesn't use a variable is #d, scoring 100. With no byte literals, it would be 8s2, scoring 1000. – ETHproductions – 2016-03-16T15:46:13.093

Oh, 5l scores 120. – ETHproductions – 2016-03-16T17:52:47.467

11

Python 2, 101010101010

print'10'*6

Blue

Posted 2015-12-28T14:14:40.930

Reputation: 22 461

10

PHP, score 10,000,000

<?=1e7;

This prints 10000000 as can be seen there.

nicael

Posted 2015-12-28T14:14:40.930

Reputation: 3 022

2Since the OP asked for the smallest integer, why did you pick an exponent of seven? Does it print without commas? – WGroleau – 2015-12-29T04:51:42.087

@WGroleau it does print without any commas, http://justachat.freevar.com/test.php

– nicael – 2015-12-29T06:28:11.617

9

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.

Martin Ender

Posted 2015-12-28T14:14:40.930

Reputation: 162 549

9

DC, 10000

4 chars program:

I4^f

5 digits output:

$ dc<<<'I4^f'
10000

yeti

Posted 2015-12-28T14:14:40.930

Reputation: 2 278

3

+1. Yep, I think that's optimal in dc. Unusually bc is shorter.

– Digital Trauma – 2015-12-28T19:00:22.277

I thought I was doing well with 6d^p (yielding 46656), but you have that beat - well done! – Toby Speight – 2016-01-06T17:19:29.157

8

Vitsy, 7! = 5040

7FN

Outputs 5040.

Try it online!

Addison Crump

Posted 2015-12-28T14:14:40.930

Reputation: 8 084

Why not 3FN outputting 6? – Peter Taylor – 2016-03-25T07:42:02.510

@PeterTaylor The number has to be greater in length, not greater in magnitude. – Addison Crump – 2016-03-26T13:29:43.267

8

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.

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

8

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.

alephalpha

Posted 2015-12-28T14:14:40.930

Reputation: 18 628

I think something is wrong with your commit messages :P – Doorknob – 2016-01-03T07:23:56.007

3@Doorknob冰 I don't know how to write commit messages, so I just use random emojis. – alephalpha – 2016-01-03T09:17:33.727

4Ok, here's the real question: what does Q push? – Cyoce – 2016-03-08T15:20:03.777

8

Brainfuck, 3333333333333333333333333 (25 threes)

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

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

23 bytes long.

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

I was considering a bf solution, are there any current interpreters that only output as numbers? – Rohan Jhunjhunwala – 2017-05-05T23:21:46.753

@RohanJhunjhunwala this outputs 51 (the ASCII code for "3") 25 times. – Level River St – 2017-05-06T02:16:00.613

@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. – Rohan Jhunjhunwala – 2017-05-06T02:32:47.840

7

CJam, score 10

A

Try it online!

Dennis

Posted 2015-12-28T14:14:40.930

Reputation: 171 923

Why not Y, score 2? – Peter Taylor – 2016-03-25T07:43:19.423

1Because 2 is only one character, so it isn't longer than the source code. – Dennis – 2016-03-25T12:48:45.530

7

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.

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

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. – OldCurmudgeon – 2015-12-29T13:31:23.110

You can replace interface with class. – LegionMammal978 – 2015-12-30T11:46:48.833

2But then main would need to be public. – Lynn – 2015-12-30T12:01:13.147

7you can shave off 2 characters by doing this for the for loop: for(A a:new A[81]) – Jack Ammo – 2016-01-01T21:48:33.730

1That's genius! Thank you. – Lynn – 2016-01-01T21:49:33.827

@OldCurmudgeon Would .pow(100) not work for some reason? – ETHproductions – 2016-03-16T15:50:18.580

Why is it an interface?? – CalculatorFeline – 2016-03-16T17:07:09.767

Read the comment four comments above yours... – Lynn – 2016-03-16T17:18:39.457

7

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.

ETHproductions

Posted 2015-12-28T14:14:40.930

Reputation: 42 391

6

Python 2, 107918163081

print 69**6

Blue

Posted 2015-12-28T14:14:40.930

Reputation: 22 461

You can remove the space between print and the 2. – Bakuriu – 2015-12-29T19:40:52.747

1@Bakuriu No you can't – Blue – 2015-12-29T20:24:38.603

69**6 is only 107918163081. – Neil – 2015-12-29T23:15:23.363

2Interstingly enough, this also works in Perl. – Grimy – 2016-01-04T16:17:10.313

6

Perl, 1000000000

print 1e9

Straightforward.

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

1Can't you reduce your score by using say? – Neil – 2015-12-29T23:10:35.147

That would require enabling the -E flag, I suppose. I'm not sure how to count that, in this challenge. – Lynn – 2015-12-30T01:16:55.123

1

Since "-M5.010, when needed, is free," you shouldn't have to count it at all.

– ThisSuitIsBlackNot – 2015-12-30T20:47:32.727

6

C++, 1e46

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

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

Glenn Randers-Pehrson

Posted 2015-12-28T14:14:40.930

Reputation: 1 837

5

O, 10

A

Apparently the score is the number we print!

refi64

Posted 2015-12-28T14:14:40.930

Reputation: 7 567

5

05AB1E, score 10

Code

T

Explanation:

T         # Puts 10 onto the stack
          # Implicit, print the last item of the stack

Adnan

Posted 2015-12-28T14:14:40.930

Reputation: 33 457

5

Mathematica, score 87,178,291,200

Print[14!]

This solution is not helped by the fact that it takes 6 characters to print anything.

LegionMammal978

Posted 2015-12-28T14:14:40.930

Reputation: 14 318

Why do you want to use Print though? Raw operations are valid programs in Mathematica (answer)

– March Ho – 2015-12-28T22:22:42.967

3@MarchHo the fact that you got away with it in the past does not mean it's generally legitimate to assume a REPL environment. ;) – Martin Ender – 2015-12-28T23:01:31.610

@MartinBüttner I don't get your point. It manifestly does not "take 6 characters to print anything" for this question in Mathematica. I don't see where REPL environments come into play here. – March Ho – 2015-12-28T23:10:15.180

2@MarchHo if you run 14! from a script file, it will not print anything. It only prints something when typed into a notebook, which is a REPL environment. – Martin Ender – 2015-12-28T23:11:58.590

@MartinBüttner I just tested in Mathematica 10, Get["C:\\test.txt"] containing the string 15! prints the expected output. Did I misinterpret what you said? – March Ho – 2015-12-28T23:34:52.840

@MarchHo, try running MathematicaScript -script C:\test.txt. – LegionMammal978 – 2015-12-28T23:56:08.333

@MarchHo what LegionMammal said. You are still invoking the code from a notebook. Mathematica code can be run as an actual script without a notebook environment just like any other programming language. – Martin Ender – 2015-12-28T23:59:27.497

1

@MartinBüttner I was about to post in Meta, but someone beat me to it

– March Ho – 2015-12-29T00:00:21.680

@MarchHo See my comment on your answer. – LegionMammal978 – 2015-12-29T00:01:28.983

We should create a golfing version of Mathematica. With one- or two-byte abbreviated commands and the massive Wolfram Language command set, it would do well in many of these contests. – Michael Stern – 2016-03-08T05:10:39.813

@LegionMammal978 I love that name, I was assuming "MMA" but yours is better. Don't try to bite off the whole spec in one go -- maybe Mthmtca 0.1 can have shortened command names plus automatic universal right parenthesis (both relatively easy to implement), and leave everything else for version 0.2. – Michael Stern – 2016-03-08T14:03:09.683

@MichaelStern The repository can be found here.

– LegionMammal978 – 2016-03-08T15:42:58.313

@LegionMammal978 yessir – Michael Stern – 2016-03-08T16:48:30.113

@MichaelStern Give me a few minutes to test some things. – LegionMammal978 – 2016-03-08T16:57:27.970

Echo[13!] works – TuxCopter – 2016-10-27T11:15:42.133

@TùxCräftîñg That prints a leading &gt;&gt;. – LegionMammal978 – 2016-10-27T11:16:23.237

5

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

Luis Mendo

Posted 2015-12-28T14:14:40.930

Reputation: 68 100

5

Brian & Chuck, 11,111,111,111,111 (≈ 1.1e13)

?1<SO>{?
#{>.>-?

Here, <SO> stands for the "shift out" control character with character code 0x0E.

Try it online.

That's all my language covered then. :)

Explanation

The 1 in Brian's code (first line) is used for printing. Then <SO> is used as a counter variable. The rest is just a simple loop setup which prints that 1 while decrementing the <SO> down to zero.

Martin Ender

Posted 2015-12-28T14:14:40.930

Reputation: 162 549

5

Marbelous, 100000000000000000000000 (24 digits)

Previously 28, 26 digits

@1
-- 10 '0
=0 @1
!! \\ /\ '1

All the spaces are superfluous. Outputs 1 then 0 repeatedly while counting down in parallel. Layout and counter tweaked to produce the desired amount of output for a 23-byte program.

Sparr

Posted 2015-12-28T14:14:40.930

Reputation: 4 846

5

TeaScript, 10 points

e

The e variable is preinitialized to 10

Try it online

Downgoat

Posted 2015-12-28T14:14:40.930

Reputation: 20 837

3Isn't that confusing, given that e is another number? – Cyoce – 2015-12-30T08:37:57.167

@Cyoce true but variable Me is e so both are usable – Downgoat – 2015-12-31T17:42:51.550

5

Ruby, 1679616

p 6**8

Computes 68.

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

5

QBasic, 15625

?5^6

? auto-magically gets converted to PRINT, 5 to the power of 6 yields the most convenient number of more than 4 bytes.

steenbergh

Posted 2015-12-28T14:14:40.930

Reputation: 6 474

QBasic automagically converts your code to PRINT 5 ^ 6 (which is 11 bytes) before it is run. I'm not counting the 2 bytes for the newline because that would be mean but strictly speaking even the empty QBasic program has two bytes... – CJ Dennis – 2015-12-29T09:44:11.937

1@CJDennis If I save this in a .BAS file and ask QBasic.exe to /run that, it runs. – steenbergh – 2015-12-29T12:01:11.460

5

Java, 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 (~1082)

Curent version:

interface N{static void main(String[]a){for(int i=0;i<46;)System.out.print(++i);}}

Previous version [score floor(1084/9)=111111111111111111111111111111111111111111111111111111111111111111111111111111111111]:

interface N{static void main(String[]a){for(int i=0;i<84;i++)System.out.print(1);}}

Original version (score 1093):

interface N{static void main(String[]a){System.out.print(java.math.BigInteger.TEN.pow(93));}}

SuperJedi224

Posted 2015-12-28T14:14:40.930

Reputation: 9 433

5

Labyrinth, 1001101

>1!:
@

As Martin predicted, one order of magnitude lower is possible! Try it online!

I'm not going to go into full details as to how Labyrinth works, but this trace should give a rough idea as to what's going on anyway:

Inst   Detail                                    Stack            Output
---------------------------------------------------------------------------------
>      Rotate row 0 right                        []

[Board update]
:>1!
@

1      * 10 + 1                                  [1]
!      Output                                    []               1
1      * 10 + 1                                  [1]
>      Rotate row 1 right                        []

[Board update]
:>1!
 @

:      Dup                                       [0 0]
>      Rotate row 0 right                        [0]

[Board update]
!:>1
 @

1      * 10 + 1                                  [1]
>      Rotate row 1 right                        []

[Board update]
!:>1
  @

:      Dup                                       [0 0]
!      Output                                    [0]              0
:      Dup                                       [0 0]
>      Rotate row 0 right                        [0]

[Board update]
1!:>
  @

:      Dup                                       [0 0]
!      Output                                    [0]              0
1      * 10 + 1                                  [1]
!      Output                                    []               1
:      Dup                                       [0 0]
>      Rotate row 0 right                        [0]

[Board update]
>1!:
  @

1      * 10 + 1                                  [1]
!      Output                                    []               1
:      Dup                                       [0 0]
!      Output                                    [0]              0
1      * 10 + 1                                  [1]
>      Rotate row 1 right                        []

[Board update]
>1!:
   @

1      * 10 + 1                                  [1]
!      Output                                    []               1
:      Dup                                       [0 0]
@      Halt

Sp3000

Posted 2015-12-28T14:14:40.930

Reputation: 54 224

5

Come Here, floor(1042/9)

0CALL42cCOME FROM SGNcCALLc-1c1TELL49NEXT

Ungolfed:

0 NOTE It is illegal to "COME FROM" a nonexistant label.
CALL 42 c NOTE c=42
COME FROM SGN c NOTE If c>0, come back here after next reaching label 1
CALL c-1 c NOTE decrement c
1 TELL 49 NEXT NOTE I really don't understand why the parser requires NEXT here, but it does

SuperJedi224

Posted 2015-12-28T14:14:40.930

Reputation: 9 433

4

Jelly, score 120

5!

Calculates the factorial of 5. Try it online!

Dennis

Posted 2015-12-28T14:14:40.930

Reputation: 171 923

2It specifies that the text encoding should be UTF-8 - is that followed here? – Addison Crump – 2015-12-28T14:58:32.483

I was going to say -- this might be the first esolang that actually can't trivially answer this question. – Arandur – 2015-12-28T14:59:52.250

@FlagAsSpam I missed that unusual rule. It's fixed now. – Dennis – 2015-12-28T15:27:18.050

4

Python 2, 1,000,000,000

Even lower than my other answer (but includes a trailing zero, which I did not count towards the score). Similar to the Matlab/Octave solution.

print 1e9

Willem

Posted 2015-12-28T14:14:40.930

Reputation: 1 498

1'Lowest integer' - the .0 at the end stops this from being valid. – Blue – 2015-12-28T23:47:40.013

1@muddyfish: The integers are members of the set of all real numbers. Representing an integer as a decimal string doesn't stop it from being an exact integer. I won't fully parse with a function that only parses C integral types (like strtol), but the question asked for an integer, not an int. – Peter Cordes – 2015-12-29T05:03:12.960

1I have to agree that although it does not look like an integer, it still satisfies all the mathematical properties of an integer. – Willem – 2015-12-29T08:42:43.513

4

Windows PowerShell, 1000

1e3

Another methods to achieve something similar, though not as small, may be

1KB   # 1024

Joey

Posted 2015-12-28T14:14:40.930

Reputation: 9 576

4

C, 327228837632722883924195568 (28 digits)

main(){printf("%u%u%u");}

Undefined behavior is awesome!!! This solution probably doesn't count due to UB, but I just wanted to put the idea out there.

Using Coliru, I get that output every time.

usandfriends

Posted 2015-12-28T14:14:40.930

Reputation: 582

4

NTFJ, 111111111111111111111111111111 (30 ones)

Code:

#(#~~~#@::::::)$::::*****(~#^

Explanation

One the first run through we push six 49s (ASCII value for one) to set up for the loop this only runs the first time because # is used to enter the loop. On all subsequent runs the # is skipped and thus the loop is skipped as well.

After that as well as with all future runs we pop a value $ which for the first run is a 49 but for all subsequent runs is the zero used to skip the loop. We then duplicate the TOS four times and output five times decreasing the total by one. If the TOS is zero (i.e. not 49) we end the program otherwise we jump back to the first instruction immediately skipping to back to four duplications.

This outputs 30 ones and has a length of 29.

Additional solution

I thought since Conor O'Brien forgot about the : operator I'd do a solution without it to be fair to him.

#(##################~)~##~~~#@*~~##~~~~@*~~##~~~~@*$(~#^

This prints

100100100100100100100100100100100100100100100100100100100

I was going to make an explanation for this but I forgot how it works.

Wheat Wizard

Posted 2015-12-28T14:14:40.930

Reputation: 33 549

Wow, I like the alternative solution. Fantastic! – Conor O'Brien – 2016-10-24T11:17:17.527

3

Microscript/Microscript II, 100

2E

SuperJedi224

Posted 2015-12-28T14:14:40.930

Reputation: 9 433

3

Haskell, 1001129150390625

main=print$75^8

Probably minimal. I can't think of a shorter way to make a large integer and print it than exponentiation (^); you need at least main=print$. Of all choices for base and exponent, 75^8 was the lowest number longer than the code.

EDIT: Thanks, Neil!

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

1We still have no topic on meta that defines the minimum requirements for a full program. Maybe we can use the -e option of ghc and go with ghc -e "4^5" for a 3 byte program with a score of 1024. – nimi – 2015-12-28T19:58:59.663

Actually 75^8 is only 1001129150390625. – Neil – 2016-01-01T22:11:27.467

3

GolfScript, 3125

5.?

Computes 55.

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

3

Excel & LibreOffice Calc – 10000

=1e4

Save as challenge.csv, then open in Excel or Calc. Usually just double-clicking will do.

Yimin Rong

Posted 2015-12-28T14:14:40.930

Reputation: 6 663

"I.e. the code must be shorter than the number of digits in the resulting number" – nicael – 2015-12-29T22:17:39.317

=1e4 would do for 10000. – Tom Carpenter – 2015-12-30T13:17:03.887

3

Java, 10^72

interface A{static void main(String[]a){System.out.printf("1%072d",0);}}

john16384

Posted 2015-12-28T14:14:40.930

Reputation: 171

3

Befunge (quirkster implementation), 123648

"**.@

Pushes the string **.@ onto the stack, wraps around, exits string mode, and executes it, multiplying the ASCII values of the last three characters and outputting the result as an integer.

Edit: Only works if the playfield width is considered to be implicitly set to the maximum line width, not right-padded to a default size. Thanks to James Holderness for the catch.

histocrat

Posted 2015-12-28T14:14:40.930

Reputation: 18 102

3

><>, 10560

'*n`

Try it online!

'*n`'         Push chars to stack, giving [42 110 96]
     *        Multiply, giving [42 10560]
      n       Output 10560 as number
       `      Unrecognised char, so the program outputs with an error

Unfortunately, out of all chars smaller than ` which give a 5-digit output, none of [\]^_ work since they are valid instructions which don't cause the termination we require.

Sp3000

Posted 2015-12-28T14:14:40.930

Reputation: 54 224

2

Cubically, score 836,308,545 328,426,785 45,454,545 1,818

Knocked the score down by utilizing existing face values instead of wasting space messing with the notepad. Too bad I golfed it before the revision history kicked in :(

%22

Try it online! Explanation:

  • Functions are called strangely in Cubically. When the interpreter hits a function, it sets the internal "default function" to that function. Then, when it hits any integer, it calls the internal default function with that integer. So R1 will call R with 1, R11 will call R with 1 twice, etc.
  • %22 prints the value of the front face (18) two times.

Outdated:

Fun fact! Due to how functions are called in Cubically, for each extra byte (6 at the end) we add, we can multiply the output length. Example:

:5*6666%66

Prints 836308545836308545. :5*6666%666 prints 836308545836308545836308545. Etc.

MD XF

Posted 2015-12-28T14:14:40.930

Reputation: 8 337

2

Befunge 98 - 10000000000:

a8k:8k*.@

or:

a8k:8k*.q  

The number printed has twelve didgits and the program is eleven bytes long.

ppperry

Posted 2015-12-28T14:14:40.930

Reputation: 3 052

2

AppleScript, 10^3

1e3

Implicit output? :o

Addison Crump

Posted 2015-12-28T14:14:40.930

Reputation: 8 084

2

gs2, 10

A single byte of CP437. Prints 10. Try it here!

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

3OP said UTF-8 (I disagree with the rules, but OP might not change them.) – lirtosiast – 2015-12-29T03:39:35.590

This answer is invalid because this is 2 bytes in UTF-8, which is the encoding specified in the challenge. – Mego – 2016-04-06T18:57:53.830

@Mego CP437 and UTF-8 are compatible in the first 128 bytes. This is just a dingbat that represents the actual control character. – Dennis – 2016-04-06T20:31:32.640

Oh, whoops, I missed the fact that it was in the lower half. I should know better, considering how much I've worked with CP437 for Seriously... – Mego – 2016-04-06T20:38:15.613

2

Mouse-2002, 10101010

k is 10, but ! printing costs a byte, so this is the only way.

kkkk(!)

Exits with an error, if run interactively.

cat

Posted 2015-12-28T14:14:40.930

Reputation: 4 037

2

C++, 111111111111111111111111111111111111111111111111111111111111 (60 ones)

#include<cstdio>
int main(int c){while(c++<61)putchar(49);}

Translation of my C answer.

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

2

Befunge-93, 101010101010

6<_@#:-1.+4

I can't immediately think of anything shorter, but I think this is pretty good.

EDIT: got it from 161616161616 to 101010101010.

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

100000000 – James Holderness – 2018-01-16T18:34:09.303

@JamesHolderness, why not just one d?

– Jo King – 2018-01-17T04:06:03.613

@JoKing I'm an idiot! No idea how I missed that. Can also do one c for a smaller number.

– James Holderness – 2018-01-17T10:52:15.447

2

Commodore Basic, 1000000

1?1E6

Mark

Posted 2015-12-28T14:14:40.930

Reputation: 1 896

2

Mathematica, score 120

5!

Contrary to the assertion in this answer, you don't need Print to print something in Mathematica. Mathematical operations like exponentiation and factorials are supported by default.

March Ho

Posted 2015-12-28T14:14:40.930

Reputation: 256

why did you change your score from 120 to 1024? – Sparr – 2015-12-28T22:27:13.420

@Sparr It was a mistake, thanks for pointing it out. – March Ho – 2015-12-28T22:28:13.900

@glenn I was under the impression the length of the number must be longer than the program itself. – March Ho – 2015-12-28T22:33:13.423

1"Write a full program (not just a function)"; this isn't a full program, it's a REPL snippet. – LegionMammal978 – 2015-12-28T23:57:10.507

I think this would be a valid TI-BASIC answer too. – kamoroso94 – 2017-12-04T02:58:13.450

2

Self-modifying Brainf***, 111,000,000,000,000 (1.11e14)

_ represents a null byte \x00. Prints each digit 3 times. I'm also fairly certain this is minimal. Interleaving digits with code is longer. There are several shorter solutions where the number is of equal length, but not longer.

<[...<]_00001

mbomb007

Posted 2015-12-28T14:14:40.930

Reputation: 16 876

2

PowerShell, 111111

"1"*6

If the newline counts, then "1"*5 prints 11111\n.

Itsme2003

Posted 2015-12-28T14:14:40.930

Reputation: 129

2

><> (fish), 1000010000

a:*:*:nn;

explaination:

duplicates and multiplies 10 to get to two 10000's then prints both, being ten total characters long, one more than the program character length

torcado

Posted 2015-12-28T14:14:40.930

Reputation: 460

First reaction : meh, there must be something better, let's try using a loop, using ascii values as integer or even exiting with an error ! 1 hour later : <strike>damn you</strike> well done torcado ! – Aaron – 2016-03-08T16:07:46.710

@Aaron haha yeah I also thought there was for sure a shorter way to do this but this is the best I could get. Thanks! – torcado – 2016-03-16T17:00:10.797

1

7, 16031, language postdates challenge

1603

Try it online!

It's unclear what "must be encoded in ASCII or UTF-8" means in 7. The most obvious meaning is that I have to write each command as a single character, and encode its name in ASCII (this is particularly suitable here, because that's an input encoding that the 7 interpreter understands). In this case, the best I can do is 16031 (the first character here is a literal that's never executed, thus could be any octal digit; 0603 outputs 06031, but leading zeroes are disallowed, so the best digit we can use here is 1).

Explanation

A 7 program is basically a sequence of literals that are pushed to the stack, unescaping them in the process; thus the "initial run" of the program is always fairly boring and just puts things on the stack. Then the rightmost stack element is executed (while leaving it on the stack), repeatedly until the program exits.

Although all the commands that can occur in literals have names, some of the commands that can appear as the result of unescaping don't. The usual convention I use for this on PPCG is to bold "active" commands (which do something interesting when executed), and leave "passive" commands (which just push an active command) unboldened. The four active commands that don't have names are then given the same name as the corresponding passive command, and thus I rely on the font to distinguish. 7's "stack" is a little strange, relying on separators | between elements (which are manipulated as though they were a character in the language).

||           1603    Initial stack and program; 6 is active, 103 are passive
|103                 Result after the program's initial run
|103         103     (implicit) Top stack element is copied to the program
|1031        03      1 appends 1 to the stack
716031       3       0 escapes the top stack element and removes the | before it
                     3 prints output, and exits if the stack is low

The output in this case is 716031. The first step in producing output is to check to see if it needs escaping (the algorithm for this is fairly complex, but typically boils down to making active commands passive, and enclosing passive sections in 76). In most of my 7 programs, it does (due to containing anonymous commands), but all the commands seen there have names (unsurprisingly, because we escaped it manually on the previous line), so no escaping is necessary. Next, the first character output in the entire program (here, 7) specifies the output format (7 means "the same as the input", so the output will be printed as a sequence of octal digits in ASCII). Finally, the remaining characters, 16031, will be printed directly (shown here without the bold because one they're printed, they aren't commands any more, just characters).

Interestingly, the victory condition is different from a , and that actually mattered. It's possible to write a smaller program that produces numerical output longer than itself: 163 outputs 71631 (basically because it doesn't escape explicitly, and implicit escaping by the 3 command always prepends a 7 to the output). However, in this case, although the program is shorter, the output is larger, so using a longer program gave a smaller score.

user62131

Posted 2015-12-28T14:14:40.930

Reputation:

1

Common Lisp (GCL), 1586013445029888

(princ(exp 35))

Harry

Posted 2015-12-28T14:14:40.930

Reputation: 620

1

Brachylog (2), 11111, language postdates challenge

1j₅w

Try it online!

Just makes five copies of 1 and prints them.

user62131

Posted 2015-12-28T14:14:40.930

Reputation:

1

C, 1844674407370955161518446744073709551615 (40 digits)

main(){printf("%lu%1$lu",-1ul);}

Certainly not winning, but it's a fun challenge and this is a fun answer.

How it works:

  • The printf format specifier %lu prints a long unsigned integer.
  • The printf format specifier %1$lu prints the first long unsigned integer in printf's argument list.
  • -1ul in printf's argument list is -1 cast to an unsigned long. Since the value is negative and the integer is unsigned, it turns into the maximum value an unsigned long can hold.

MD XF

Posted 2015-12-28T14:14:40.930

Reputation: 8 337

1

Vim, 11111

5i1␛

Works by inserting the character 1 five times. Try it online!

Herman Lauenstein

Posted 2015-12-28T14:14:40.930

Reputation: 2 256

1

F#, 10000000000000000000

Here's a pretty clever trick:

printf"%o"(1L<<<57)

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

1

Candy, 10

N

push the number 10 onto the stack. 10 is useful since it's ascii for \n

Candy dumps the stack on exit.

Dale Johnson

Posted 2015-12-28T14:14:40.930

Reputation: 509

2BTW, your score is the number printed, not the length of the code. – ETHproductions – 2015-12-29T20:29:53.770

@ETHproductions oh, should I have printed something like 10 (1 digit)? – Dale Johnson – 2016-01-01T02:15:49.283

1

Bash, 100000000 (9 digits)

bc<<<A^8

Solution by @Digital Trauma ported to bash.

Glenn Randers-Pehrson

Posted 2015-12-28T14:14:40.930

Reputation: 1 837

crap, I took a break from my answer before coming back to finish tidying it up and post it, and you snuck in ahead of me >.< – Peter Cordes – 2015-12-29T04:58:42.620

1

Pure bash, 1125899906842624 (250, 16 digits).

echo $((1<<50))

This is the best pure bash I've come up with, not depending on any special conditions or using external commands.

Bash + POSIX, 100000000: (108, 9 digits)

bc<<<A^8   # bc with a here-string script that evaluates 10^8

Thanks to Digital Trauma's answer for bringing up bc and the fact that it accepts hex digits even with the default ibase=10. Glenn beat me to actually posting the bc-based answer, but I'll leave it in my answer as well for completeness.


I'm an infrequent golfer, so IDK if there are standard assumptions that rule this out, to avoid needing overly pedantic rules in every question:

Bash + rule-bending: 10737418240 (5 * 231, 11 digits)

The question doesn't appear to rule out the the long number being be part of a longer string (e.g. part of an error message):

$((5<<31))          # prints "bash: 10737418240: command not found"

Bash assuming a 5-digit PID: a 10-digit number (PID repeated twice)

echo $$$$       # depends on the shell's current PID being a 5-digit number

Or repeating 3 times to still work with a 4-digit PID: a 12 or 15 digit number. (e.g. 573057305730: The shell's PID repeated 3 times).

echo $$$$$$     # depends on the shell's current PID being a 4-digit number

test framework for the number-generating expression:

e='$((5<<31))'; eval decimal=$e;  echo "$decimal: srclen=${#e}  digits=${#decimal}"

test framework for whole commands (works with methods other than the error-message hack.)

e='bc<<<A^8'; eval decimal=\"\$\($e\)\";  echo "$decimal: srclen=${#e}  digits=${#decimal}"

up-arrow and edit e to try different numbers.


Ideas that didn't work: (for readability, not fully golfed and in a (subshell) to avoid breaking your interactive shell when testing.)

(set {1..9}; IFS=; echo "$*" )   # $* in double quotes joins with no separator if IFS is null.  Too much setup overhead

You could play silly tricks to get $0 to contain a long number, but then you'd have to count the whole bash -c 'echo $0' $((10**7)) as part of the program.

Peter Cordes

Posted 2015-12-28T14:14:40.930

Reputation: 1 494

1

ResPlicate, score 111111111

2 9 0 49

I was thinking of all kinds of complicated ways to do this, but it turns out the solution is very simple. After one step, you get:

0 49 0 49 0 49 0 49 0 49 0 49 0 49 0 49 0 49

which is just 9 commands to print ASCII number 49, so "111111111" is output.

quintopia

Posted 2015-12-28T14:14:40.930

Reputation: 3 159

1

C, score ~10^26 (100000000000000004764729344)

main(){printf("%f",1E26);}

Apparently float failes there a little. Tested there.

nicael

Posted 2015-12-28T14:14:40.930

Reputation: 3 022

1

beeswax, 909090 823543

The new solution just computes 7^7, which is 85547 smaller than the old solution.

_7FB{

Explanation:

_       [0,0,0]•       create bee
 7      [0,0,7]•       push 7 on lstack
  F     [7,7,7]•       set all stack values to 1st value
   B    [7,7,823573]•  1st=1st^2nd
    {                  output lstack 1st to STDOUT

M L

Posted 2015-12-28T14:14:40.930

Reputation: 2 445

1

BotEngine, floor(1065/9)

v
e1
ldddddd<
ldddddd<
ldddddd<
ldddddd<
ldddddd<
>ddddP

This is probably the largest number of d instructions I've ever used in a single BotEngine program.

SuperJedi224

Posted 2015-12-28T14:14:40.930

Reputation: 9 433

1

x86 MS-DOS .COM file, score 111,111,111,111

Hex dump of the 11 byte .COM file (to reverse the hex dump, pass it into xxd -r -seek -256):

0100: b4 02 b2 31 b1 0c cd 21 e2 fc c3                   ...1...!...

Unassembled using debug:

0100 B402     MOV AH,02         ; prepare to print character to stdout
0102 B231     MOV DL,31         ; ASCII '1' to be printed
0104 B10C     MOV CL.0C         ; counter=12
0106 CD21     INT 21            ; print
0108 E2FC     LOOP 0106         ; repeat until counter is 0
010A C3       RET               ; end

krubo

Posted 2015-12-28T14:14:40.930

Reputation: 151

1

Binary-Encoded Golfical, floor(1014/9)

Hexdump of binary encoding:

00 90 01 00 31 18 18 18 18 18 18 18 1D

Original image:

enter image description here

Magnified 80x, with color labels:

enter image description here

Explanation: Stores 49 (the code point of the digit 1), prints it as a character 7 times, then turns around and prints it seven more times before terminating.

SuperJedi224

Posted 2015-12-28T14:14:40.930

Reputation: 9 433

1

ForceLang, 1013

Noncompeting, language postdates the question.

io.write 1e13

SuperJedi224

Posted 2015-12-28T14:14:40.930

Reputation: 9 433

1

Reng v.3.3, score 104976

Try it here!

I²²n~

Prints

104976

This squares I (18) twice, yielding 104976. n prints this, and ~ terminates.

Reng v.2.2, score 101010101010

{An}``````~

Previously, score 96549157373046880

Z{ZZ**}#xxxxxxn~

Prints 96549157373046880.

Conor O'Brien

Posted 2015-12-28T14:14:40.930

Reputation: 25 859

1

Cy, score 134217728

8 9 ^ :<

8 9 pushes a 9 and an 8 to the stack (duh), ^ computes 8 ^ 9 (exponent, not xor), :< prints it.

This was not intended to be a golfing language, but this answer ended up pretty short compared to "real" languages. I didn't even need exponential notation!

Cyoce

Posted 2015-12-28T14:14:40.930

Reputation: 2 273

1

R - 134217728

cat(8^9)

I doubt it can be make any shorter having to use cat function. Pretty boring, though.

Edit: Improved thanks to Christian Sievers

Albert Masclans

Posted 2015-12-28T14:14:40.930

Reputation: 714

My version answers with "1e+09", and anyway, why not 8^9? – Christian Sievers – 2016-09-21T11:26:30.930

1

marioLANG, 700666666005555550044444400333333002222220011111100 (51 digits for 49 bytes)

still no marioLANG anwser? well here's one,

Try it online

+
+
+
+
+
+!::::::<
+#======"
:>)::(-[!
="======#

Ether Frog

Posted 2015-12-28T14:14:40.930

Reputation: 333

1

Google Sheets, 15625

=5^6

equals 15625

weatherman115

Posted 2015-12-28T14:14:40.930

Reputation: 525

1

Python 3, 100000000000

One digit shorter than the current python 3

print(1e11)

prints 1*(10^11)

george

Posted 2015-12-28T14:14:40.930

Reputation: 731

1

Jelly, score 100

³

Prints 100 when counting as 2 bytes in UTF-8.

Try it Online!

Sunny Pun

Posted 2015-12-28T14:14:40.930

Reputation: 731

1

Charcoal (non-competing), 11111111

F⁸1

Try it online!

for(8)Print('1').

Charcoal could have done better (1111 score) if source was measured in Charcoal bytes.

ASCII-only

Posted 2015-12-28T14:14:40.930

Reputation: 2 518

1

Carrot, 11111

1^*4

1     //"1" is pushed into the stack
 ^    //The stack is finished
  *   //Multiply or duplicate string operator (in this case it is the latter)
   4  //Duplicate the string 5 times (4+1)

"1" is pushed into the stack. Then the * operator duplicates the string 5 times, not 4 times because the * operator on strings always duplicates the strings 1 time more than what is stated, because duplicating it once is meaningless and hence it is removed. So the program outputs 11111.

Cows quack

Posted 2015-12-28T14:14:40.930

Reputation: 12 883

1

PHP, 9223372036854775807

I know they're not the shortest for PHP but..

9223372036854775807

<?=PHP_INT_MAX;

10000000000000000000

<?=str_pad(1,20,0);

CT14.IT

Posted 2015-12-28T14:14:40.930

Reputation: 231

1

Python 2, 1000000000

A simple program in a simple language. I have two answers depending on wether the python shell is permitted or not.

If it isn't, then:

print 1e9

Which is 9 bytes and outputs 1000000000, 10 bytes.

If it is, then:

1e3

Which is 3 bytes and outputs 1000, 4 bytes.

These ignore the .0 printed on the end of these numbers since the method returns a float and the question asks for an int.

Anonymous No Lifer

Posted 2015-12-28T14:14:40.930

Reputation: 311

0

DUP, 100100

'd$..

Put character d on stack, duplicate it, print its value twice.

Online DUP interpreter.

My Julia implementation on GitHub, with comprehensive language description.

M L

Posted 2015-12-28T14:14:40.930

Reputation: 2 445

0

tcl, 10000000000000000

puts [expr 1e16]

Outputs:

10000000000000000.0

The integer part is 1 and 16 zeros.

http://rextester.com/RWNL80143

sergiol

Posted 2015-12-28T14:14:40.930

Reputation: 1 831

Doesn't that make this answer invalid? – LegionMammal978 – 2017-01-17T02:07:58.343

@LegionMammal978: Waiting feedback from question's author. 1e17 is still an integer! – sergiol – 2017-01-17T10:16:25.737

"1e+17" has a length of 5, while your program has a length of 16 – 12Me21 – 2017-01-30T15:17:38.753

@12Me21: I don't have a + in 1e17! – sergiol – 2017-01-30T15:42:37.763

The output does – 12Me21 – 2017-01-30T15:47:46.297

@LegionMammal978: I hope my answer is now valid – sergiol – 2017-01-30T16:44:00.253

@12Me21: I hope my answer is now valid – sergiol – 2017-01-30T16:44:27.100

0

SmileBASIC, 16713480 1111111 10000

?1E4

Boring.

Previous Answers: ?-#CYAN, ?"1"*7

12Me21

Posted 2015-12-28T14:14:40.930

Reputation: 3 806

0

Underload, score 100000100000

(100000):*S

Esolanging Fruit

Posted 2015-12-28T14:14:40.930

Reputation: 6 495

0

Syms, 999980001 1111111 (noncompeting)

1:7;*>

Try it online!

CalculatorFeline

Posted 2015-12-28T14:14:40.930

Reputation: 2 323

0

Alice, 3628800 (10!)

a/P
o@

Try it online!

Explanation

a   Push 10.
/   Reflect to SE. Switch to Ordinal.
    Reflect off bottom right corner, move back NW.
/   Reflect to W. Switch to Cardinal.
a   Push 10.
    Wrap around to the end of the first line.
P   Compute 10! = 3628800.
/   Reflect to NW. Switch to Ordinal.
    Immediately reflect off top boundary, move SW.
o   Implicitly convert the result to a string and print it.
    Reflect off bottom left corner, move back NE.
/   Reflect to S. Switch to Cardinal.
@   Terminate the program.

Martin Ender

Posted 2015-12-28T14:14:40.930

Reputation: 162 549

0

Braingolf, 20

Oh hey look I can golf it now thanks to niladic stuff

+

Niladic + (ie run when the stack is empty) pushes 20 to the stack, implicit output.

Braingolf, 100

Just throwing in my 2 cents (or 2 bytes, as it were)

#d

Pushes the charcode of the character 'd' to the stack, which is 100. Braingolf will automatically print the last element of the stack when the code terminates if there is no semicolon present in the code.

Note:

As with every Braingolf submission thus-far on PPCG, this is non-competing, as the language was created on 3rd May 2017.

Mayube

Posted 2015-12-28T14:14:40.930

Reputation: 4 938

0

S.I.L.O.S, 28 byte, 111111111111111111111111111111 (29 ones)

x=29
lbla
print 1
x-1
if x a

Ugh! Looping is expensive!

Try it online!

Rohan Jhunjhunwala

Posted 2015-12-28T14:14:40.930

Reputation: 1 878

0

Check, score 1000010000

Non-competing as language postdates the challenge.

>10000pp

Esolanging Fruit

Posted 2015-12-28T14:14:40.930

Reputation: 6 495

0

VBA, ~ 8 ^ 41 , 37 15625 , 5 Bytes

Code:

Anonymous VBE immediate window function that takes no input and outputs to the VBE immediate window

?5^6

Output:

15625

Previous Version

Subroutine that takes no input and outputs a base 10 int that is longer to it to the VBE immediate window.

The output of this should mathematically be

10633823966279326983230456482242756608

however, due to loss of precision due to the Format(n,0) this is approximated down as

10633823966279300000000000000000000000

Sub a:Debug.?Format(8 ^ 41,0):End Sub

Taylor Scott

Posted 2015-12-28T14:14:40.930

Reputation: 4 742

0

Whitespace, 11111111111111111111111111111111111111 (38 ones)

Visible representation:

SSTTSSTTSNNSSNSSSTNSNSTNSTTSSSSNSNTTN

What it does:

     push -38
loop:
     push 1
      dup
       pnum
      add
     dup
      jn loop

Surprisingly short for a whitespace program. Other considered approaches were pushing a big integer followed by a sequence of duplicate-multiply but this proved to be less efficient.

CensoredUsername

Posted 2015-12-28T14:14:40.930

Reputation: 716

0

Java, 1e66

Shortest full program I could make:

interface A{static void main(String[]a){System.out.print(1e66);}}

With 65 bytes, this program outputs:

1e66

Try it online!

NotBaal

Posted 2015-12-28T14:14:40.930

Reputation: 61

0

Röda, score 10,000,000,000,000 (1013)

main{[10^13]}

Try it online!

Röda statement, score 1,000,000 (106)

[10^6]

The program is executed using this command (the flags are required to execute the program, so they are free):

röda -e "[10^6]" -n

fergusq

Posted 2015-12-28T14:14:40.930

Reputation: 4 472

0

Prolog(SWI), 1e+15

?-write(1e15).

Outputs (surprise surprise) 1.0e+15

Try it online!

NotBaal

Posted 2015-12-28T14:14:40.930

Reputation: 61

0

Pyke, 1 byte

T

Try it here!

In Pyke, as well as in Pyth, T is a constant pre-initialised to 10.

Mr. Xcoder

Posted 2015-12-28T14:14:40.930

Reputation: 24 203

0

Implicit, score 65

A

Pushes the ASCII value for A (65). Implicit output.

MD XF

Posted 2015-12-28T14:14:40.930

Reputation: 8 337

0

Commodore 64/VIC 20 BASIC, 5 PETSCII characters (excluding the carriage return)

 0?1E5

Some caveats here; firstly, Commodore BASIC adds in a white space before printing any number or numeric variable; secondly, there is no concept of true integer types in Commodore BASIC (I think that applies to all variants through to BASIC 7 on the Commodore 128); and finally LISTing the program will show its un-obfuscate form, and add in a white space after each line number, so the above symbolic listing becomes:

0 PRINT1E5

So, on that basis, it could be that this is automatically disqualified if these caveats are taken into account. Does my initial golfed version count as a valid entry?

Shaun Bebbers

Posted 2015-12-28T14:14:40.930

Reputation: 1 059

0

Brain-Flak, 106735757048926755512911448358783973263883108352

48 digits, 46 bytes.

(((()()()){})){({}[()]<(({({}[()])}{}){})>)}{}

Try it online! (but not really because it will error with a segment fault).

This uses the common triangular method, ({{}[()]}), but applies it recursively on the previous result. It starts with 6 as both the counter and the total and starts the loop, first decrementing the counter, then replacing the total with 2*triangle(total). Repeat a few times and it gets exponential, with each repetition roughly doubling the amount of digits.

Python code used to calculate the total:

def tri(t):
    return (t)*(t-1)/2

def f(n,t):
    for _ in range(n):
        t = tri(t)*2
    return t

print(len(str(int(f(6,6))))

Jo King

Posted 2015-12-28T14:14:40.930

Reputation: 5 911

0

Momema, score 10000000001000000000

01000000000-8*0-8*0

Explanation:

0  1000000000  #  [0] = 1000000000
-8 *0          #  print num [0]
-8 *0          #  print num [0]

Esolanging Fruit

Posted 2015-12-28T14:14:40.930

Reputation: 6 495

0

Python 3, 1028071702528

print(52**7)

One byte longer than Python 2, but the same approach.

EDIT: turns out my search wasn't exhaustive enough -- thanks, Neil.

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

252**7 is only 1028071702528. – Neil – 2015-12-29T23:12:38.217

0

Mumps, score 100000

W 1e5

Writes 10^5, or 100000. Had the newline not been optional, that would have added 2 more characters to the program:

W 1e7,!  ; this would output 10000000

Now that I mention it... it would be interesting to see how much would change on some of the winning answers if an explicit newline was required - especially the 0 or 1 byte answers. :-)

zmerch

Posted 2015-12-28T14:14:40.930

Reputation: 441

0

Python 2, 111,111,111,111

Lower than the other python answers

print'1'*12

Willem

Posted 2015-12-28T14:14:40.930

Reputation: 1 498

0

MSM, 10101010

.;.;.01

7 byes for an 8 byte output. Repeatedly duplicates and concatenenates starting with 10.

nimi

Posted 2015-12-28T14:14:40.930

Reputation: 28 202

0

Visual Basic .NET, 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111 (86 ones)

Module A
Sub Main
System.Console.Write(New System.String("1"C,86))
End Sub
End Module

Oh dear. (This is shorter than using a loop, unless there's some fast way to do that that I don't know about.)

Lynn

Posted 2015-12-28T14:14:40.930

Reputation: 41 980

1You don't need to write System.. – Qwertiy – 2016-03-16T17:37:44.780

0

k4, 10000

$ cat a.k; echo
_1e4
$ wc -c a.k
4 a.k
$ q a.k </dev/null
10000
$ 

The input file is missing its trailing newline, but that doesn't matter to the interpreter. The language's default behavior on reading code files is to print the output of any statement which is not explicitly suppressed, so all I have to do is create the number. Exponential notation creates floats though, so I have to floor it to create an integer, otherwise the output would be 10000f (the default representation of a float that has no fractional part).

Aaron Davies

Posted 2015-12-28T14:14:40.930

Reputation: 831

0

dc, 117649

$ cat a.dc; echo
7 6^p
$ wc -c a.dc
5 a.dc
$ dc -f a.dc
117649
$ 

Inspired by WGroleau's comment on the question.

Aaron Davies

Posted 2015-12-28T14:14:40.930

Reputation: 831

Six to the power of something? Three bytes code. What happens with five instead of six? – WGroleau – 2015-12-29T05:01:13.837

Never mind—I didn't see the seven space – WGroleau – 2015-12-29T05:07:54.863

0

Fortran 77, 36 ones

^Iwrite(*,'(36i1)'),(1,i=1,36)
^Iend

(where ^I represents the TAB character.  This is the first Fortran
program I've written or have even seen that uses TABs)

FORTRAN IV, 54 ones

      PRINT1,(1,I=1,54)
    1 FORMAT(54I1)
      END

Both solutions write a newline after the number. Note that if you're using a line printer to look at the output, the first "1" will be interpreted as a page-feed and the numbers in the programs will need to be increased by 1, to 37 for Fortran 77 and to 55 for Fortran IV.

Glenn Randers-Pehrson

Posted 2015-12-28T14:14:40.930

Reputation: 1 837

0

Insomnia, 129

i

Apart from i (105), r (115) or } (125) outputs the same result, since the position of the bit pointer doesn't matter when it's the last state-changing operation.

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2015-12-28T14:14:40.930

Reputation: 5 161

0

C, 1407260946921681491238744 (25 digits)

24 characters:

main(){printf("%lu%u");}

The output is nondeterministic (which may disqualify this submission). After a few million runs, I've only gotten 25 digit output. Some day I should figure out what GCC is (setting up a.out to be) sprinkling past the end of the stack for printf() to use here.

Eric Towers

Posted 2015-12-28T14:14:40.930

Reputation: 616

0

Ceylon, 111111111111111111111111111111111111111111 (42 digits)

This was my second try:

shared void run(){print("1".repeat(42));}

A program with length 41, prints a string of 42 ones.


My first, more complicated try printed 112589990684262411529215046068469761152921504606846976 (54 digits):

shared void run(){print("``2^50````2^60````2^60``");}

This program has a length of 53 bytes.

Ceylon integers go just up to right under 2^63, which gives us only 19 digits. Due to the boilerplate here we need to concatenate three of them, which is done by the use of string templates (the contents of `` ... `` inside a string literal are evaluated as an expression and then converted into a string). Then it was simply a point of looking up the powers of two with (relatively) smallest first digits (2^50 starts with 1125, 2^60 with 1152), such that the length of them sums to 54. I guess combining other powers might make the program slightly shorter, but this still will not beat the simple one above.

Paŭlo Ebermann

Posted 2015-12-28T14:14:40.930

Reputation: 870

0

PHP, score 10,000,000,000

echo 1e10;

Assuming the opening/closing tags don't count, otherwise it's

<?=echo 1e13;

And if we allow non-PHP, we have <?=1e7 and 1e3 as options. Taking the first answer as the "most correct" of the four.

ricdesi

Posted 2015-12-28T14:14:40.930

Reputation: 479

0

Pylons, 10

B

How it works:

B # Push B to the stack. (pre-initialized to 10)
  # The stack is implicitly printed at the end of the program.

Morgan Thrapp

Posted 2015-12-28T14:14:40.930

Reputation: 3 375

0

PHP, 100 ones, 23 chars

<?=str_repeat("1",1E2);

timmyRS

Posted 2015-12-28T14:14:40.930

Reputation: 319

@MorganThrapp Thanks, fixed it. – timmyRS – 2016-02-24T19:33:06.937

@MorganThrapp bytes.... ok, now. – timmyRS – 2016-02-24T19:36:21.313

1&lt;?=str_repeat("1",23); works for score 11111111111111111111111. – Esolanging Fruit – 2017-05-30T03:41:03.947

0

Mathcad, 3 "bytes", 4 digits, 5040

Updated version. See text of Original version for suppression of decimal places discussion. As the original version, used one integer raised to power of another, I've also included what I think is the smallest number that meets the criterion.

enter image description here


Original (and wrong!) Version ...

Here's two Mathcad expressions (you may regard the "3" version as even more cheaty than the 8 version, hence my providing the two versions ...)

enter image description here

Mathcad doesn't have a "text" file as such. It operates more as a 2D whiteboard, where you can either type characters and operators onto a "worksheet", or enter them via a single-click toolbar. Mathcad stores the worksheet as an xml file. From a user perspective, however, typing "cat" counts as 3 distinct characters, which I'm taking to be the equivalent of "bytes" for the purposes of golfing; pi is single character as well. An operator, such as "=" (evaluate), "+" (add) or ":=" (define), also counts as a "byte".

There are also a number of settings, such as the number of decimal places shown displaying a real number, which are available from a dialog box. If, for example, setting the number of decimals to zero counts as a 0 "byte" operation, then π= is the shortest one I can think of. If this is regarded as cheating from a golfing perspective, then the exponent version should meet the spirit of the competition.

Stuart Bruff

Posted 2015-12-28T14:14:40.930

Reputation: 431

Nice answer, but the goal of this challenge is to print an integer that has more digits than the program has bytes, e.g. print a 3-digit number with a 2 byte program. Could you please fix this? – ETHproductions – 2016-03-16T15:44:20.943

Doh! yabinm (Yet Another Brain In Neutral Moment). – Stuart Bruff – 2016-03-16T17:13:40.717

0

Oracle SQL 11.2, 30903154382632612361920641803529

SELECT''||POWER(9,33)FROM DUAL;

Jeto

Posted 2015-12-28T14:14:40.930

Reputation: 1 531

0

Desmos, 6561

9^4

equals 6561

previous answer, 1048576

2^{20}

equals 1048576

weatherman115

Posted 2015-12-28T14:14:40.930

Reputation: 525

0

AWK, 1e21

I didn't see an AWK answer, so here's mine.

Since a 'full program' was requested, this is the best I could come up with (full program is a bit fuzzy in AWK).

awk '{$0=1e21}1'<<<1

If we don't consider how the program is called as part of the program, then the score could be dropped to about 1e13 using:

 '{$0=1e13}1'

Robert Benson

Posted 2015-12-28T14:14:40.930

Reputation: 1 259

0

Forth, 1073741824 (2^30)

1 30 << .

Try it online

If the result could be left on the stack:

100663296

96 20 <<

mbomb007

Posted 2015-12-28T14:14:40.930

Reputation: 16 876

0

Turtlèd, 100000000000

11:[*'0l]'1

11- set register to 11

: move right by amount in register

[*'0l] loop: [* ]- while current cell is not *, '0- write zero to cell, l -move left

'1- write one

Destructible Lemon

Posted 2015-12-28T14:14:40.930

Reputation: 4 669

0

///, score 111111111111

/./111/....

Try it online!

/./111/ removes itself and replaces every . with 111, so .... becomes 111111111111.

acrolith

Posted 2015-12-28T14:14:40.930

Reputation: 3 040