192
\$\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\$
24
  • 67
    \$\begingroup\$ Number 1 on the Hot Network Questions. Not bad for a first question... \$\endgroup\$ Dec 28, 2015 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, 2015 at 15:57
  • 9
    \$\begingroup\$ Is 1.0 an integer? \$\endgroup\$
    – histocrat
    Dec 28, 2015 at 20:05
  • 33
    \$\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, 2015 at 3:35
  • 8
    \$\begingroup\$ @ZachGates that's not how the HNQ list works. ;) \$\endgroup\$ Dec 29, 2015 at 8:38

180 Answers 180

5
\$\begingroup\$

05AB1E, score 10

Code

T

Explanation:

T         # Puts 10 onto the stack
          # Implicit, print the last item of the stack
\$\endgroup\$
5
\$\begingroup\$

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.

\$\endgroup\$
5
\$\begingroup\$

Mathematica, score 87,178,291,200

Print[14!]

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

\$\endgroup\$
16
  • \$\begingroup\$ Why do you want to use Print though? Raw operations are valid programs in Mathematica (answer) \$\endgroup\$
    – March Ho
    Dec 28, 2015 at 22:22
  • 3
    \$\begingroup\$ @MarchHo the fact that you got away with it in the past does not mean it's generally legitimate to assume a REPL environment. ;) \$\endgroup\$ Dec 28, 2015 at 23:01
  • \$\begingroup\$ @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. \$\endgroup\$
    – March Ho
    Dec 28, 2015 at 23:10
  • 2
    \$\begingroup\$ @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. \$\endgroup\$ Dec 28, 2015 at 23:11
  • 1
    \$\begingroup\$ @MartinBüttner I was about to post in Meta, but someone beat me to it \$\endgroup\$
    – March Ho
    Dec 29, 2015 at 0:00
5
\$\begingroup\$

Ruby, 1679616

p 6**8

Computes 68.

\$\endgroup\$
5
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ 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... \$\endgroup\$
    – CJ Dennis
    Dec 29, 2015 at 9:44
  • 1
    \$\begingroup\$ @CJDennis If I save this in a .BAS file and ask QBasic.exe to /run that, it runs. \$\endgroup\$
    – steenbergh
    Dec 29, 2015 at 12:01
5
\$\begingroup\$

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.

\$\endgroup\$
5
\$\begingroup\$

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));}}
\$\endgroup\$
5
\$\begingroup\$

TeaScript, 10 points

e

The e variable is preinitialized to 10

Try it online

\$\endgroup\$
2
  • 3
    \$\begingroup\$ Isn't that confusing, given that e is another number? \$\endgroup\$
    – Cyoce
    Dec 30, 2015 at 8:37
  • \$\begingroup\$ @Cyoce true but variable Me is e so both are usable \$\endgroup\$
    – Downgoat
    Dec 31, 2015 at 17:42
5
\$\begingroup\$

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

\$\endgroup\$
5
\$\begingroup\$

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
\$\endgroup\$
5
\$\begingroup\$

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
\$\endgroup\$
5
+150
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ Wow, I like the alternative solution. Fantastic! \$\endgroup\$ Oct 24, 2016 at 11:17
4
\$\begingroup\$

GolfScript, 3125

5.?

Computes 55.

\$\endgroup\$
4
\$\begingroup\$

Windows PowerShell, 1000

1e3

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

1KB   # 1024
\$\endgroup\$
4
\$\begingroup\$

Excel & LibreOffice Calc – 10000

=1e4

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

\$\endgroup\$
2
  • \$\begingroup\$ "I.e. the code must be shorter than the number of digits in the resulting number" \$\endgroup\$
    – nicael
    Dec 29, 2015 at 22:17
  • \$\begingroup\$ =1e4 would do for 10000. \$\endgroup\$ Dec 30, 2015 at 13:17
4
\$\begingroup\$

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.

\$\endgroup\$
4
\$\begingroup\$

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
\$\endgroup\$
3
  • 1
    \$\begingroup\$ 'Lowest integer' - the .0 at the end stops this from being valid. \$\endgroup\$
    – Blue
    Dec 28, 2015 at 23:47
  • 1
    \$\begingroup\$ @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. \$\endgroup\$ Dec 29, 2015 at 5:03
  • 1
    \$\begingroup\$ I have to agree that although it does not look like an integer, it still satisfies all the mathematical properties of an integer. \$\endgroup\$
    – Willem
    Dec 29, 2015 at 8:42
4
\$\begingroup\$

Vim, 11111

5i1␛

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

\$\endgroup\$
4
\$\begingroup\$

Flurry, score 1


The empty program returns the identity function λa. a = λab. a b, which is the Church numeral representation of 1. The interpreter recognizes and prints it as such:

$ ./Flurry -nin -c ''
1

It takes the interpreter \$O(n)\$ time to convert from integer to decimal in order to print it, so any other answer would probably need to use character IO if it wanted to execute in reasonable time.

\$\endgroup\$
4
\$\begingroup\$

GNU sed, 100010001000100010001000 (~1e23)

Without any basic math support, just text manipulation, the easiest solution I found was to duplicate some starting number, 1000 in this case. Printing is implicit at the end of the script, 22 bytes in length.

s:$:1000:
s:.*:&&&&&&:

Try it online!

I believe this is the first sed answer to this question. It's also my first after a long break from code golf :)

\$\endgroup\$
3
  • \$\begingroup\$ this is the same size, but produces a slightly smaller number \$\endgroup\$
    – Jo King
    Dec 15, 2022 at 2:03
  • \$\begingroup\$ @JoKing Nice. Do you want to post it separately or should I include it in my answer? \$\endgroup\$
    – seshoumara
    Dec 16, 2022 at 7:34
  • \$\begingroup\$ Feel free to update your answer. I don't actually know that much sed \$\endgroup\$
    – Jo King
    Dec 16, 2022 at 9:49
3
\$\begingroup\$

Microscript/Microscript II, 100

2E
\$\endgroup\$
3
\$\begingroup\$

C++, 111111111111111111111111111111111111111111111111111111111111 (60 ones)

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

Translation of my C answer.

\$\endgroup\$
2
  • \$\begingroup\$ You could get 59 nines with int main(int c){while(c-->-putchar(57);)} for the second line. The same result could be get with a for instead and adding 2 ;. \$\endgroup\$
    – Phil1970
    Sep 15, 2019 at 1:05
  • \$\begingroup\$ You should post that yourself, it's quite clever! \$\endgroup\$
    – lynn
    Sep 16, 2019 at 18:34
3
\$\begingroup\$

Java, 10^72

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

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!

\$\endgroup\$
2
  • 1
    \$\begingroup\$ We 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. \$\endgroup\$
    – nimi
    Dec 28, 2015 at 19:58
  • \$\begingroup\$ Actually 75^8 is only 1001129150390625. \$\endgroup\$
    – Neil
    Jan 1, 2016 at 22:11
3
\$\begingroup\$

Befunge 98 - 10000000000:

a8k:8k*.@

or:

a8k:8k*.q  

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

\$\endgroup\$
3
\$\begingroup\$

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

\$\endgroup\$
1
  • \$\begingroup\$ My version answers with "1e+09", and anyway, why not 8^9? \$\endgroup\$ Sep 21, 2016 at 11:26
3
\$\begingroup\$

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.

\$\endgroup\$
0
3
\$\begingroup\$

Lost, score 111111111111111111111111111111111111 (39 36 ones)

/<<<<<%<@<<<?<<</
?+-*66<:<+1$<*77/

-111100000000000000000000000000000000000 score (-4 ones) thanks to @JoKing.

Try it online or verify that it's deterministic.

Explanation:

Explanation of the language in general:

Lost is a 2D path-walking language. Most 2D path-walking languages start at the top-left position and travel towards the right by default. Lost is unique however, in that both the start position AND starting direction it travels in is completely random. So making the program deterministic, meaning it will have the same output regardless of where it starts or travels, can be quite tricky.

A Lost program of 2 rows and 5 characters per row can have 40 possible program flows. It can start on any one of the 10 characters in the program, and it can start traveling up/north, down/south, left/west, or right/east.

In Lost you therefore want to lead everything to a starting position, so it'll follow the designed path you want it to. In addition, you'll usually have to clean the stack when it starts somewhere in the middle.

Explanation of the program:

? will pop the top item of the stack, and will skip the next character if it is NOT a 0. Because of this, the stack will be emptied completely due to the leading characters of both lines while traveling downwards. So the ? pops values, and we'll ignore the /, until the stack is empty. At this point, an implicitly pushed 0 is used for the ?, and the / is no longer skipped.

Another important fact is that in a Lost program, an @ will terminate the program, but only when the safety is 'off'. When the program starts, the safety is always 'on' by default, otherwise a program flow starting at the exit character @ would immediately terminate without doing anything. The % will turn this safety 'off', so when we now encounter an @ the program will terminate (if the safety is still 'on', the @ will be a no-op instead).

As for the program flow: all arrows and / reflects will lead the path towards the < between the % and @.

From there, the program flow will:

  • <: Travel left/west
  • %: Turn the safety 'off' (so if we would now encounter the @, the program will stop)
  • <<<<<: Continue traveling left/west
  • /: Reflect to a downwards/south direction
  • ?: Pop the top value of the stack, and if it's NOT 0, skip the next operand. As mentioned earlier, this ?/ will clean the entire stack in case we started somewhere in between, after which an implicit pushed 0 will allow us to go to the next step:
  • / (first row; first column): Reflect to a left/west direction
  • / (first row; last column): Reflect to a downwards/south direction
  • / (second row; last column): Reflect to a left/west direction
    • 77*: Push 49 (push 7; push 7; pop and multiply the top two values)
    • <: Continue traveling left/west
    • $: Swap the top two values. If the stack only contains a single value, it will implicitly use a 0 to swap.
    • 1+: Add one to this counter-value
    • <: Continue traveling left/west
    • :: Duplicate the top of the stack
    • <: And once again, continue traveling left/west
    • 66*: Push 36 (push 6; push 6; pop and multiply the top two values)
    • -+: Subtract it from the duplicated counter-value
    • ?: Pop, and if this is NOT 0, skip the next operand. The first iteration this will be -36, thus NOT 0, so it will skip the / when it wraps around to the other side and do the same again starting at 77*. This will continue until the counter-value has become 0, after which the mirror / is not skipped.
  • / (second row; last column): In that case, it will reflect downwards/south
  • / (first row; last column): Reflect to a left/west direction again
  • <<<: Continue traveling left/west
  • ?: Pop the top value on the stack (the duplicated counter-value)
  • <<<: Continue traveling left/west
  • @: Terminate the program if the safety is 'off' (which it is at this point). After which all the values on the stack will be output implicitly. Using the -A program argument flag, these code-points (the 49s) will be output as a string of characters ('1's) instead without delimiter. Without this flag, it would output the 49s as numbers with space delimiters; so due to those implicit space delimiters, we can't simply push 1s and remove the -A flag.
\$\endgroup\$
3
  • 1
    \$\begingroup\$ I was able to shorten the program but I can't get 38, 1s. Try it online! \$\endgroup\$
    – Wheat Wizard
    Apr 3, 2020 at 14:45
  • \$\begingroup\$ @AdHocGarfHunter Oh, I initially had the reversed. I was able to make it shorter, but couldn't figure out how to have less than 39 1s. Unfortunately 37 is a prime number, and 38/39 are only divisible by the pairs [[1,38],[2,19]] and [[1,39],[3,13]] respectively, which makes them annoying to work with. \$\endgroup\$ Apr 3, 2020 at 15:04
  • \$\begingroup\$ @JoKing Very nice approach with the reflects! Thanks. :) \$\endgroup\$ Aug 8, 2020 at 15:51
3
\$\begingroup\$

Charcoal, 11111111

F⁸1

Try it online!

for(8)Print('1').

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

\$\endgroup\$
3
\$\begingroup\$

Pip, 1 byte

t

Outputs 10.

Try It Online!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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