| Bytes | Lang | Time | Link |
|---|---|---|---|
| nan | 241108T091957Z | RARE Kpo | |
| 001 | HP‑41C series | 240318T133719Z | Kai Burg |
| nan | Uiua | 240129T113023Z | Adelie |
| nan | Perl 5 | 240129T154415Z | Xcali |
| nan | Kotlin | 240129T153505Z | The Zip |
| nan | Awk | 240129T133200Z | camelCas |
| 001 | Nibbles | 230804T171521Z | Dominic |
| 120 | Itr | 230804T133543Z | bsoelch |
| nan | ForWhile | 230804T134347Z | bsoelch |
| nan | Rec | 230804T131422Z | D.. |
| nan | BitCycle | 221215T231254Z | Jo King |
| 100 | Pyt | 221217T014148Z | Kip the |
| 025 | C gcc | 221214T170330Z | l4m2 |
| 1010 | GolfScript | 221214T004223Z | Bubbler |
| nan | 221213T033305Z | bigyihsu | |
| nan | GNU sed | 221213T030808Z | seshouma |
| 001 | Pip | 221107T032739Z | Aiden Ch |
| nan | Knight v2 | 221107T011451Z | EasyasPi |
| nan | Pascal | 221105T155054Z | Kai Burg |
| 018 | Bitcoin Cash Script BitAuth IDE | 221105T185157Z | bca-0353 |
| nan | BitCycle u | 220603T132232Z | Nilster |
| nan | Charcoal | 161024T080125Z | ASCII-on |
| nan | Check | 170530T033851Z | Esolangi |
| nan | Shakespeare Programming Language | 220604T113506Z | jimmy230 |
| 001 | Vyxal | 210612T060931Z | emanresu |
| nan | Pxem | 210322T130953Z | user1004 |
| 012 | Python 52^7 | 210322T102122Z | SegFault |
| 001 | Flurry | 200811T025421Z | Esolangi |
| nan | Lost | 200403T130926Z | Kevin Cr |
| 111 | RGBDS macros | 200808T140852Z | Maya |
| nan | MAWP 1.0 | 200808T094615Z | Razetime |
| nan | cQuents | 200404T164704Z | PkmnQ |
| nan | Burlesque | 200120T092519Z | DeathInc |
| 024 | Fortran GFortran | 200120T091913Z | DeathInc |
| 111 | naz | 200120T082949Z | sporebal |
| 111 | x8616 | 200102T204234Z | 640KB |
| 010 | Keg hr | 190914T135443Z | user8505 |
| nan | Python 2 | 191224T043530Z | Sagittar |
| nan | Intcode | 191224T041359Z | The Fift |
| 100 | W | 191214T071053Z | user8505 |
| nan | Shakespeare Programming Language | 191203T104231Z | Robin Ry |
| 000 | TSQL | 191203T150055Z | BradC |
| 124 | Wren | 191203T111430Z | user8505 |
| 1000 | Runic Enchantments | 191203T041425Z | Draco18s |
| 1013 | ForceLang | 160308T022901Z | SuperJed |
| nan | Rust | 190723T210718Z | ruohola |
| nan | Alchemist | 190130T073428Z | ASCII-on |
| 008 | Attache | 180824T015150Z | Conor O& |
| nan | Z80Golf | 180807T071919Z | Bubbler |
| nan | Pascal FPC | 180713T152326Z | AlexRace |
| nan | Perl 6 | 180713T153522Z | Phil H |
| 166 | Java | 170814T082703Z | NotBaal |
| nan | Yabasic/QBasic/VBA | 170531T142933Z | Taylor R |
| nan | Z80Golf | 180617T132803Z | lynn |
| 010 | Canvas | 180420T013946Z | hakr14 |
| nan | PHP | 180420T012511Z | Titus |
| nan | BrainFlak | 180117T134745Z | Jo King |
| nan | Momema | 180212T080225Z | Esolangi |
| nan | Vim | 180116T142947Z | Endenite |
| 005 | Commodore 64/VIC 20 BASIC | 180116T133732Z | Shaun Be |
| 065 | Implicit | 170919T231159Z | MD XF |
| nan | Underload | 170210T232624Z | Esolangi |
| 020 | Braingolf | 170503T205317Z | Mayube |
| 001 | Pyke | 170909T105034Z | Mr. Xcod |
| 115 | PrologSWI | 170814T101050Z | NotBaal |
| nan | Röda | 170814T095744Z | fergusq |
| 818 | Cubically | 170618T020333Z | MD XF |
| nan | Whitespace | 170531T152130Z | Censored |
| nan | MATLAB | 151228T144925Z | Tom Carp |
| 023 | PHP | 160224T192440Z | Sainan |
| nan | C | 170529T161928Z | MD XF |
| 028 | S.I.L.O.S | 170505T231728Z | Rohan Jh |
| 120 | Mathematica | 151228T221605Z | March Ho |
| nan | NTFJ | 161023T234536Z | Wheat Wi |
| 146 | C++ | 151228T205414Z | Glenn Ra |
| 036 | Fortran 77 | 151228T231421Z | Glenn Ra |
| nan | C | 160103T095151Z | Eric Tow |
| nan | Python 3 | 160617T202145Z | george |
| nan | PHP | 161027T112529Z | CT14.IT |
| nan | Python 2 | 161029T122951Z | Anonymou |
| 111 | Python 2 | 151228T182039Z | Willem |
| 000 | Python 2 | 151228T182938Z | Willem |
| nan | tcl | 170117T011019Z | sergiol |
| nan | Brachylog 2 | 170505T204955Z | user6213 |
| nan | Alice | 170412T121307Z | Martin E |
| nan | Syms | 170303T050318Z | Calculat |
| nan | SmileBASIC | 170130T090551Z | 12Me21 |
| nan | Common Lisp GCL | 170108T072945Z | habs |
| nan | 7 | 161231T235238Z | user6213 |
| nan | DUP | 161226T054421Z | M L |
| nan | Cubix | 160316T004245Z | ETHprodu |
| nan | Befunge quirkster implementation | 160308T150948Z | histocra |
| nan | Carrot | 161024T092107Z | user4180 |
| 100 | Jelly | 161024T042510Z | Sunny Pu |
| nan | R | 160415T211506Z | Masclins |
| nan | /// | 160918T172627Z | acrolith |
| nan | Turtlèd | 160918T123355Z | Destruct |
| nan | DC | 151228T182025Z | user1921 |
| nan | Reng v.3.3 | 160325T024152Z | Conor O& |
| nan | 151228T142451Z | The Fift | |
| nan | Forth | 160617T200639Z | mbomb007 |
| 6561 | Desmos | 160614T202144Z | weatherm |
| nan | Google Sheets | 160617T190724Z | weatherm |
| 121 | AWK | 160614T212234Z | Robert B |
| nan | Haskell | 151228T162304Z | lynn |
| nan | marioLANG | 160525T143512Z | Ether Fr |
| nan | C | 151228T220707Z | Glenn Ra |
| 059 | PlatyPar | 151228T201038Z | Cyoce |
| nan | Come Here | 160326T143242Z | SuperJed |
| nan | beeswax | 151230T042144Z | M L |
| nan | Labyrinth | 160325T092719Z | Sp3000 |
| nan | ><> | 160325T070451Z | Sp3000 |
| nan | Cy | 160325T063438Z | Cyoce |
| 5040 | Mathcad | 160316T154034Z | Stuart B |
| nan | Oracle SQL 11.2 | 160316T161634Z | Jeto |
| 010 | Pylons | 160224T190725Z | Morgan T |
| 000 | PHP | 160224T190520Z | ricdesi |
| 010 | TeaScript | 151228T172003Z | Downgoat |
| 1072 | Java | 160102T215922Z | john1638 |
| nan | Ceylon | 160103T232033Z | Paŭlo Eb |
| nan | ><> fish | 160102T212307Z | torcado |
| nan | Java | 151228T175547Z | lynn |
| nan | BinaryEncoded Golfical | 160101T182234Z | SuperJed |
| 111 | x86 MSDOS .COM file | 160101T143023Z | krubo |
| nan | C | 151231T041932Z | rgajrawa |
| 176 | Fishing | 151228T145149Z | Arcturus |
| 010 | Candy | 151229T014426Z | Dale Joh |
| nan | BotEngine | 151230T151904Z | SuperJed |
| nan | Excel & LibreOffice Calc – | 151229T210943Z | user1525 |
| nan | Java | 151230T132241Z | SuperJed |
| nan | Brainfuck | 151230T121731Z | lynn |
| nan | Marbelous | 151228T170033Z | Sparr |
| nan | Python 3 | 151228T180117Z | lynn |
| nan | Python 2 | 151228T144915Z | Blue |
| nan | C | 151229T231103Z | nicael |
| 103 | AppleScript | 151228T150416Z | Addison |
| nan | PowerShell | 151229T200033Z | Itsme200 |
| 1000 | Windows PowerShell | 151229T193646Z | Joey |
| nan | ResPlicate | 151229T191025Z | quintopi |
| nan | Selfmodifying Brainf*** | 151229T163542Z | mbomb007 |
| 1063 | C# | 151228T154421Z | LegionMa |
| 129 | Insomnia | 151229T100158Z | n̴̖̋h̷͉̃ |
| 000 | PHP | 151228T150201Z | nicael |
| 016 | Pure bash | 151229T045745Z | Peter Co |
| nan | Bash | 151229T025311Z | Glenn Ra |
| 042 | Samau | 151229T015843Z | alephalp |
| nan | F# | 151229T013048Z | lynn |
| nan | Python 2 | 151228T235733Z | Blue |
| nan | QBasic | 151228T220240Z | steenber |
| nan | Commodore Basic | 151228T215036Z | Mark |
| nan | dc | 151228T212806Z | Aaron Da |
| nan | k4 | 151228T212331Z | Aaron Da |
| nan | Visual Basic .NET | 151228T200038Z | lynn |
| nan | MSM | 151228T194801Z | nimi |
| nan | Befunge93 | 151228T165634Z | lynn |
| 010 | bc | 151228T184052Z | Digital |
| nan | Mumps | 151228T180620Z | zmerch |
| nan | Perl | 151228T180600Z | lynn |
| nan | Ruby | 151228T174356Z | lynn |
| 3125 | GolfScript | 151228T173959Z | lynn |
| nan | C++ | 151228T164157Z | lynn |
| nan | Mouse2002 | 151228T163917Z | cat |
| 010 | gs2 | 151228T163803Z | lynn |
| nan | C | 151228T163412Z | lynn |
| 200 | Mathematica | 151228T153803Z | LegionMa |
| nan | Brainf**k | 151228T153933Z | Tom Carp |
| nan | Brian & Chuck | 151228T160340Z | Martin E |
| 1000 | MATL | 151228T154859Z | Luis Men |
| 120 | TI84 BASIC | 151228T153952Z | SuperJed |
| 000 | Labyrinth | 151228T152917Z | Martin E |
| 120 | Jelly | 151228T145654Z | Dennis |
| 100 | Microscript/Microscript II | 151228T152118Z | SuperJed |
| nan | Hexagony | 151228T150837Z | Adnan |
| 001 | Retina | 151228T150852Z | Martin E |
| nan | JavaScript | 151228T144809Z | nicael |
| nan | Vitsy | 151228T145547Z | Addison |
| 010 | CJam | 151228T145020Z | Dennis |
| 010 | Japt | 151228T142517Z | nicael |
| 010 | 05AB1E | 151228T144131Z | Adnan |
| 010 | Pyth | 151228T142507Z | Tom Carp |
| 010 | O | 151228T142644Z | kirbyfan |
awk
using 5
ASCIIbytes to print 6-digits
awk '$_^=6' <<<7
117649
but at the other end of the extreme, it only takes this one-liner
awk 'NF^=NF*=++NF^NF'<<<1 OFS=0
to print 10^(8^8-1) :
gwc -lcm
1 16777217 16777217
head -c 50
10000000000000000000000000000000000000000000000000
gtail -c 50
0000000000000000000000000000000000000000000000000
The next code generates a MUCH larger number - it was hanging my machine when it's trying to create a 50 GB long string in RAM :
awk 'NF^=NF+=NF+=$_' <<<4
HP‑41C series, 1
This submissions presumes there are no other programs in program memory.
We merely need to increase the number of displayed digits before placing the number on top of the stack.
The default setting is to display and round to (up to) 4 places after the radix mark (FIX 4).
01♦LBL⸆T 5 Bytes global label requires 4 + (length of string) Bytes
02 FIX 9 2 Bytes display 9 digits after radix point
NULL 1 Byte invisible Null byte before numbers
02 1 1 Byte push 1 on top of the stack (X ≔ 1)
shows, if flag 29 is set (the default),
1.000000000
or, if flag 29 is cleared,
1,000000000
If you want to print the number with an HP 82143A Printer, append a VIEW X command (2 Bytes) or shift the printer’s mode switch to the TRACE position (which will, however, print all the other commands, too).
Uiua, score 1073741824 100000
-1073641824 points from noodle man
&p1e5
Explanation
&p1e5
1e5 # Push 1e5 to the stack
&p # Print with newline
Kotlin, score 123456789101112131415161718192021222324
fun main()=(1..24).forEach{print(it)}
probably could be improved but not sure how
Awk, 1000000
$0=1e6
Must be fed a newline.
Nibbles, score 1
/
The Nibbles program "/" is 1 nibble or 0.5 bytes long, and outputs the value 1.
/ # full program
/$$ # with implicit args added
/ # divide
$ # the input (which is assigned with
# a value of 100 if no input given)
$ # by the input (also assigned to 100)
Itr, score 120
5P
computes 5 factorial (120)
Itr, score 0
The empty program in Itr prints 0 which has a length longer than the source code but is not positive.
ForWhile, score 1111111
7[49#)
prints 1 7 times
ForWhile, score 76543210
8(47+#)
For loop printing decreasing characters for 8+47 (ascii '7') downwards to 1+47 (ascii `'0')
Rec, 111111111111
The space before Well, it seems like it's a Python formatting issue.49 is required, otherwise the character will not display properly.
12[0:^\49p]
BitCycle, 100000000100000000 100000000000000
A\10v
~000~!
This program is 12 bytes long and outputs a 15 byte number. It starts with 5 bits, discarding one and printing a copy of the bits each iteration.
BitCycle actually outputs in bits (ones and zeroes), which can be interpreted as a decimal number as above. It is normally interpreted in unary with the -u flag.
BitCycle -u, 60328467484514692442875165185
AB/00v ~DDDDD@
~111 ~CD^
!
Honestly, not that much longer, but this takes a huge amount of time to execute. The code at 27 bytes, with the number at 29 digits long, which was the shortest of this format that I could find. Essentially, this repeatedly does the sum of 1 to n (as in the triangular numbers) on the same value, starting at 5, which increases exponentially. Then it outputs the sum of all these numbers
Pyt, 100
2ᴇ
2 (push 2 onto the stack)
ᴇ (raise 10 to the 2nd power)
(implicitly print)
C (gcc), >1E25, 25 bytes
main(){printf("1%025u");}
Not determined, not sure if any env make it const result
GolfScript, 1010
10.
Same length as Lynn's but gives a smaller number by pushing two copies of 10 and (implicitly) printing them side-by-side.
Some fun alternatives include n). and n(., which extract the charcode of newline from the string "\n" to get 10 (leaving an empty string at the bottom)
Go, 111111111111111111111111111111111111111111111111111111, 53 bytes
package main
func main(){for i:=1;i<55;i++{print(1)}}
Prints to STDERR.
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:.*:&&&&&&:
I believe this is the first sed answer to this question. It's also my first after a long break from code golf :)
Pascal, \$1 \! \cdot \! 10^{43}\$ or 1
See also Free Pascal.
This is a complete program according to ISO standard 10206 “Extended Pascal”, though.
Write(1E43:1:0) prints (or ought to print) the value 10000000000000000000000000000000000000000000.
The :1 specifies the minimum width the output shall occupy.
The :0 disables scientific notation and prints exactly 0 digits after the decimal point.
Since it doesn’t make sense to print the decimal point . if no digits follow, it also omits the . itself.
This behavior is an Extended Pascal extension (in ISO standard 7185 only positive integer values are accepted as format specifiers).
program p(output);begin write(1E43:1:0)end.
Note the characteristics of the built-in data type real are implementation-defined.
Write in conjunction with real (such as 1E43) always produces rounded output with respect to the last printed digit(s).
For instance, using an implementation of Pascal that internally uses IEEE 754 floating point numbers (depending on the precision) you may observe rounding errors.
This, however, is a circumstance outside of the realm of the programming language.
Sample:
9999999999999999999740000000000000000000000
Mathematically speaking the smallest positive integer value we can print in Pascal which has a longer printed length than the corresponding source code is \$1\$ (positive one).
program p(output);begin write(1.0:42)end.
This will print (the casing of the letter E may vary):
1.00000000000000000000000000000000000E+00
This is a representation of the value 1. The value 1 is in the domain of ℤ, the set of integers.
Bitcoin Cash Script (BitAuth IDE), 18 bytes
// Golfed
0x0340420f76769595
// The number 1000000000000000000 will be on top of stack
// Ungolfed
OP_DROP // clean up
<1000000> OP_DUP OP_DUP OP_MUL OP_MUL
// The number 1000000000000000000 will be on top of stack
BitCycle (-u), 3.134e144
1v>v>v>v>v>v>v>v>v
AB~>~>~>~>~>~>~>~ v~
>^>^>^>^>^>^>^>v>+
^ ~^!1BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB@
Try it online!
See it online!
The TiO has been truncated so that you can spend more time with your grandkids
This program multiplies the amount of bits entering by 256, then converts them to 1's and adds it to the output. Each time this happens, a bit moves 1 space through the line of B's. Once the bit reaches the @, the program terminates. The output can be expressed as: \$\sum_{n=1}^{60}256^n\$
BitCycle, 1.111e29 e26
~~ v
^~
AB~
~0<~BBB@
!
Try it online!
See it online!
This is a similar concept to the first one, but it outputs in binary. Specifically, 27 1's
BitCycle, 2.417e24
~~ v
^~
AB~
~0<~BBBB@
!
Try it online!
See it online!
The best of both worlds! This outputs a binary string of 81 1's, which, in decimal, is \${{2}^{81}}-{1}\$
Charcoal, 11111111
F⁸1
Charcoal could have done better (1111 score) if source was measured in Charcoal bytes.
Check, score 1000010000
>10000pp
Shakespeare Programming Language, 8.16e153 1.25e146
7 digits removed thanks to Robin Ryder.
,.Ajax,.Puck,.Act I:.Scene I:.[Exeunt][Enter Ajax and Puck]Puck:If notyou cat.Open
heart.You be twice you.Be twice you nicer I?If solet usact I.
Output:
124816326412825651210242048409681921638432768655361310722621445242881048576209715241943048388608167772163355443267108864134217728268435456536870912
Doubles the integer in a loop until it overflows the 32 bit signed integer type.
Pxem, 1000010000.
- Filename:
10000.e.p(9 bytes) - Content: empty (0 bytes)
- Total: 9 bytes
Python - 52^7, 12 bytes
print(52**7)
Edit 1: (Rip 11-ception)
After (embarrassingly) miscounting bytes, I'm back with the smaller version that turned out to be necessary. 52^7 is 1,028,071,702,528, which (at my count) is 13 bytes, and 13>12. Of course, if you could write things straight to STDOUT, you could get away with 5**6 or 15,625.
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.
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 pushed0will 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 direction77*: 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 a0to swap.1+: Add one to this counter-value<: Continue traveling left/west:: Duplicate the top of the stack<: And once again, continue traveling left/west66*: 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 at77*. This will continue until the counter-value has become0, 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-Aprogram argument flag, these code-points (the49s) will be output as a string of characters ('1's) instead without delimiter. Without this flag, it would output the49s as numbers with space delimiters; so due to those implicit space delimiters, we can't simply push1s and remove the-Aflag.
RGBDS macros, 11,111,111,111,111,111,111,111
REPT 23
PRINTI 1
ENDR
cQuents, 362880 161280 100100
#2;J4
J4 defults to base 2, and evaluates to 100 as a string. '100'+'100' = '100100'.
Burlesque, 1000 or 1111111
1e3
1cy7.+
First the boring method just printing 1000, or making an infinite number of 1s and clipping it to the length of the code+1.
Fortran (GFortran), 24 ones
print*,("1",i=1,23)
end
Better Fortran score by avoiding formats entirely.
naz, 100,000,000 11,111
1a5o
Explanation
1a5o # Output "1" five times
I slightly misunderstood the question at first — here's my original 8-byte solution:
1a1o1s8o
x86-16, IBM PC DOS, 111,111,111
B8 0A31 MOV AX, 0A31H ; AH = 0AH (write chars * CL), AL = '1'
B1 09 MOV CL, 9 ; display 9 times
CD 10 INT 10H ; call BIOS
C3 RET ; return to DOS
This is based on @krubo's answer above, but 3 bytes shorter. This uses the PC BIOS's INT 10,0AH function for output since it will repeat the same char CL number of times, saving the need for a LOOP (-2 bytes). Also, AL and AH can be initialized at the same time (-1 byte).
Keg -hr, 10
Explanation
\n # Push the newline character onto the stack (Ord code 10)
-hr # Print the item raw (i.e. as a number)
Keg, 100
d.
Pushes d and prints as integer. Fortunately 100 is a letter in the Keg code page.
Output is 100.
Other solution just for fun and has a larger amplitude(also 2 bytes):
ā
Output is 257
TIO
Python 2, 137438953472 (2^37)
print 2**37
Code is 11 bytes long, output is 12 bytes long.
Intcode, 100000000000000000000000000000000
2,7,7,7,4,7,99,10000000000000000
This is almost certainly sub-optimal, given all it does is square the number given at the end.
Shakespeare Programming Language, ~1.23e186
Prints 1234…95969798, the concatenation of all integers from 1 to 98.
,.Ajax,.Page,.Act I:.Scene I:.[Exeunt][Enter Ajax and Page]Page:You is the sum ofyou a cat.Open heart.Is you worse twice the square ofthe sum ofa big big big cat a pig?If soLet usAct I.
After many iterations, here is a version without any spare characters. The code is 186 characters, and the output is 187 characters.
T-SQL, 100,000,000,000
SELECT 1e11
Note that the shorter PRINT 1e10 doesn't seem to work in this case; in the SQL versions I tested (2012 to 2017) it keeps the output in the exponential format (1e+010), which I assume isn't allowed.
Runic Enchantments, 1000
aC@
Huh, another classic I apparently never answered.
Because the number must be strictly longer than the program (so a 3 byte program requires a 4 digit number), this is as small as we can go (but there are two ways to do it).
ForceLang, 1013
io.write 1e13
Z80Golf, 111111111 (8 bytes) 11111111 (7 bytes)
00000000: 3676 6636 3b3e 31 6vf6;>1
Disassembly
start:
ld (hl), $76 ; 36 76 ; overwrite the 1st byte of program to `halt`
ld h, (hl) ; 66 ; h = $76; hl = $7600
ld (hl), $3b ; 36 3b ; write `dec sp` to memory $7600
ld a, $31 ; 3e 31 ; a = '1'
The main point is what happens after the program runs through the code. Every time before reaching putchar, the PC hits dec sp at $7600. This means each run of putchar increases SP by 1 instead of 2. So the return addresses become the following:
$7600 -> $7676 -> $3666 -> $3b36 -> $3e3b -> $313e -> $0031 -> $0000
Note that, when the return address is $7676, dec sp is skipped. So the ASCII 1 is printed 8 times in total.
Previous solution, 111111111 (8 bytes)
00000000: 3e31 0609 ff10 fd76 >1.....v
Disassembly
start:
ld a,$31 ; 3e 31 ; a = '1'
ld b,9 ; 06 09 ; b = 9
loop:
rst $38 ; ff ; equivalent to "call $8000" or "call putchar"
djnz loop ; 10 fd ; b -= 1; if (b) goto loop
halt ; 76
Arguably less clever than Lynn's solution but still an improvement. This uses the instruction djnz which is similar to dec b then jr nz, label, but one byte shorter. If b is not touched before the loop, b starts with zero and the loop runs exactly 256 times.
Pascal (FPC), 10^52 1111111111111111111111111111111111111111111111 (~1.1e46)
var i:word;begin for i:=1to 46do write(1)end.
Obvious one, I missed it somehow at first, thinking it would be bigger number.
Previous approach - 10^52 (10000000000000000000000000000000000000000000000000000)
uses sysutils;begin write(1,Format('%.52D',[0]))end.
Format is a function in sysutils which gives a string from specified formatting string and array of arguments. Formatting string works pretty much like in C: % starts the part which will be replaced, D means integer in decimal format, .52 for D means the number will be written with at least 52 digits; since 0 has less than 52 digits, it is left-padded with zeroes. 1 is written before it to make a valid integer.
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
Z80Golf, 123334567 (8 bytes)
00000000: 3cf6 30fe 3820 0176 <.0.8 .v
Disassembly:
inc a
or '0'
cmp '8'
jr nz, ok
halt
ok:
Runs as follows:
- A is incremented, then
or'd by'0', giving'1'. - This is not
'8', so we jump past thehalt. - Code runs through many NOPs into putchar (
$8000). We print '1'. Then we effectivelyreturn: The PC is set to(SP)which is$f63c, the first word in memory (i.e. the first word of our code) – we never pushed anything, so we're stack-underflowing into our own code, interpreting it as 16-bit addresses. SP is incremented by 2, now$0002. - PC runs through NOPs from
$f63cto$0000, the start of our code. A is incremented to'2'. - We jump past the
haltagain and run into$8000. We print '2', then jump to$fe30and SP is now$0004. We run from there into$0000, the start of our code again. - We similarly print '3', but the next return address we pop is
$2038, which means the PC reaches$8000again before it reaches our code; so we print '3' again, then returning to$7601and thus printing '3' a third time; before finally returning to$0000where execution continues as normal. Now SP is$000a. - Nothing is weird past here: the return address will always be
$0000sinceSPis now pointing after our code. We count up printing '4', '5', '6', '7' until finally A = '8' and wehalt.
Canvas, 10
A
A pushes 10 to the stack, then Canvas inplicitly prints the item at the top of the stack.
PHP, 10000000
10 million (8 digits) printed in 7 bytes:
<?=1e7;
Almost 2.5 years and I am the first to think of that? Amazing.
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)))))
Momema, score 10000000001000000000
01000000000-8*0-8*0
Explanation:
0 1000000000 # [0] = 1000000000
-8 *0 # print num [0]
-8 *0 # print num [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?
Underload, score 100000100000
(100000):*S
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.
Röda, score 10,000,000,000,000 (1013)
main{[10^13]}
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
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
R1will callRwith1,R11will callRwith1twice, etc. %22prints 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.
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.
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.
PHP, 100 ones, 23 chars
<?=str_repeat("1",1E2);
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
printfformat specifier%luprints along unsignedinteger. - The
printfformat specifier%1$luprints the firstlong unsignedinteger inprintf's argument list. -1ulinprintf's argument list is-1cast to anunsigned long. Since the value is negative and the integer is unsigned, it turns into the maximum value anunsigned longcan hold.
S.I.L.O.S, 28 byte, 111111111111111111111111111111 (29 ones)
x=29
lbla
print 1
x-1
if x a
Ugh! Looping is expensive!
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.
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.
C++, 1e46
#include <stdio.h>
main(){printf("1%046d",0);}
Newline would require an additional 2 bytes, using format "1%048d\n"
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.
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.
Python 3, 100000000000
One digit shorter than the current python 3
print(1e11)
prints 1*(10^11)
PHP, 9223372036854775807
I know they're not the shortest for PHP but..
9223372036854775807
<?=PHP_INT_MAX;
10000000000000000000
<?=str_pad(1,20,0);
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.
Python 2, 111,111,111,111
Lower than the other python answers
print'1'*12
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
tcl, 10000000000000000
puts [expr 1e16]
Outputs:
10000000000000000.0
The integer part is 1 and 16 zeros.
Brachylog (2), 11111, language postdates challenge
1j₅w
Just makes five copies of 1 and prints them.
Alice, 3628800 (10!)
a/P
o@
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.
SmileBASIC, 16713480 1111111 10000
?1E4
Boring.
Previous Answers: ?-#CYAN, ?"1"*7
Common Lisp (GCL), 1586013445029888
(princ(exp 35))
7, 16031, language postdates challenge
1603
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 7 … 6). 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 code-golf, 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.
DUP, 100100
'd$..
Put character d on stack, duplicate it, print its value twice.
My Julia implementation on GitHub, with comprehensive language description.
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.
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.
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.
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.
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
///, score 111111111111
/./111/....
/./111/ removes itself and replaces every . with 111, so .... becomes 111111111111.
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
Reng v.3.3, score 104976
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.
Befunge 98 - 10000000000:
a8k:8k*.@
or:
a8k:8k*.q
The number printed has twelve didgits and the program is eleven bytes long.
Forth, 1073741824 (2^30)
1 30 << .
If the result could be left on the stack:
100663296
96 20 <<
Desmos, 6561
9^4
equals 6561
previous answer, 1048576
2^{20}
equals 1048576
Google Sheets, 15625
=5^6
equals 15625
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'
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!
marioLANG, 700666666005555550044444400333333002222220011111100 (51 digits for 49 bytes)
still no marioLANG anwser? well here's one,
+
+
+
+
+
+!::::::<
+#======"
:>)::(-[!
="======#
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
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.
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
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
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
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
><>, 10560
'*n`
'*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.
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!
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.
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 ...)
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.
Oracle SQL 11.2, 30903154382632612361920641803529
SELECT''||POWER(9,33)FROM DUAL;
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.
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.
Java, 10^72
interface A{static void main(String[]a){System.out.printf("1%072d",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.
><> (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
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.
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:

Magnified 80x, with color labels:

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.
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
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.
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.
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.
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.
Excel & LibreOffice Calc – 10000
=1e4
Save as challenge.csv, then open in Excel or Calc. Usually just double-clicking will do.
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));}}
Brainfuck, 3333333333333333333333333 (25 threes)
This is written "from scratch" so I think it's okay to post a separate answer:
-[>+>+<<-----]>-[-->.<]
23 bytes long.
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.
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.
Python 2, 107918163081
print 69**6
C, score ~10^26 (100000000000000004764729344)
main(){printf("%f",1E26);}
Apparently float failes there a little. Tested there.
AppleScript, 10^3
1e3
Implicit output? :o
PowerShell, 111111
"1"*6
If the newline counts, then "1"*5 prints 11111\n.
Windows PowerShell, 1000
1e3
Another methods to achieve something similar, though not as small, may be
1KB # 1024
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.
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
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...
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.
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.
Bash, 100000000 (9 digits)
bc<<<A^8
Solution by @Digital Trauma ported to bash.
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.
F#, 10000000000000000000
Here's a pretty clever trick:
printf"%o"(1L<<<57)
Python 2, 101010101010
print'10'*6
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.
Commodore Basic, 1000000
1?1E6
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.
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).
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.)
MSM, 10101010
.;.;.01
7 byes for an 8 byte output. Repeatedly duplicates and concatenenates starting with 10.
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.
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.
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. :-)
Perl, 1000000000
print 1e9
Straightforward.
Ruby, 1679616
p 6**8
Computes 68.
GolfScript, 3125
5.?
Computes 55.
C++, 111111111111111111111111111111111111111111111111111111111111 (60 ones)
#include<cstdio>
int main(int c){while(c++<61)putchar(49);}
Translation of my C answer.
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.
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.
Mathematica, score 87,178,291,200
Print[14!]
This solution is not helped by the fact that it takes 6 characters to print anything.
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.
Brian & Chuck, 11,111,111,111,111 (≈ 1.1e13)
?1<SO>{?
#{>.>-?
Here, <SO> stands for the "shift out" control character with character code 0x0E.
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.
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
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...)
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.
Microscript/Microscript II, 100
2E
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.
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.
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.
05AB1E, score 10
Code
T
Explanation:
T # Puts 10 onto the stack
# Implicit, print the last item of the stack
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.
O, 10
A
Apparently the score is the number we print!


