In this challenge, you should write a program or function which takes no input and prints or returns a string with the same number of bytes as the program itself. There are a few rules:
- You may only output bytes in the printable ASCII range (0x20 to 0x7E, inclusive), or newlines (0x0A or 0x0D).
- Your code must not be a quine, so the code and the output must differ in at least one byte.
- Your code must be at least one byte long.
- If your output contains trailing newlines, those are part of the byte count.
- If your code requires non-standard command-line flags, count them as usual (i.e. by adding the difference to a standard invocation of your language's implementation to the byte count), and the output's length must match your solution's score. E.g. if your program is
aband requires the non-standard flag-n(we'll assume it can't be combined with standard flags, so it's 3 bytes), you should output 5 bytes in total. - The output doesn't always have to be the same, as long as you can show that every possible output satisfies the above requirements.
- Usual quine rules don't apply. You may read the source code or its size, but I doubt this will be shorter than hardcoding it in most languages.
You may write a program or a function and use any of the standard methods of providing output. Note that if you print the result, you may choose to print it either to the standard output or the standard error stream, but only one of them counts.
You may use any programming language, but note that these loopholes are forbidden by default.
This is code-golf, so the shortest valid answer – measured in bytes – wins.
Leaderboard
var QUESTION_ID=121056,OVERRIDE_USER=8478;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){var F=function(a){return a.lang.replace(/<\/?a.*?>/g,"").toLowerCase()},el=F(e),sl=F(s);return el>sl?1:el<sl?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <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><div id="language-list"> <h2>Winners 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><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>
-
2\$\begingroup\$ Related. Related. \$\endgroup\$Martin Ender– Martin Ender2017年05月17日 11:19:42 +00:00Commented May 17, 2017 at 11:19
-
1\$\begingroup\$ @Mr.Xcoder Yes, if you declare them as such. \$\endgroup\$Martin Ender– Martin Ender2017年05月17日 16:25:14 +00:00Commented May 17, 2017 at 16:25
-
1\$\begingroup\$ @DJMcMayhem I figured that in many esolangs it's trivial to print a null byte with one byte of code or similar things, and thought it would lead to more interesting answers if the results were actually readable. \$\endgroup\$Martin Ender– Martin Ender2017年05月17日 16:45:23 +00:00Commented May 17, 2017 at 16:45
-
4\$\begingroup\$ @MartinEnder You should probably disallow output by exit code, which is a default. If you allow it nearly every one byte program in nearly every language is allowed. One user has already done this \$\endgroup\$Wheat Wizard– Wheat Wizard ♦2017年05月17日 22:37:40 +00:00Commented May 17, 2017 at 22:37
-
2\$\begingroup\$ @WheatWizard output by exit code is not a string, so it doesn't apply here. \$\endgroup\$Martin Ender– Martin Ender2017年05月18日 04:29:06 +00:00Commented May 18, 2017 at 4:29
291 Answers 291
Jelly, 1 byte
V
Quite a few Jelly one byters - this is one - it evaluates the left argument which, when nothing is provided as input, defaults to zero which in turn evaluates to zero and the result is implicitly printed, a 0.
In fact, of the 256 bytes in the code-page there are only 95 that do not currently produce a different one byte output within the specified range when run as a full program; these are (as code-page characters in byte order):
¡¢£¦©1⁄2¿€ÇÑÞßçıȷñ÷þ"#&',-./0123456789:;?@IMRTVZ\`dmpstxyz{}~°3459ƓƈɠḶỌṬḊĖİL·ṄȮṖṘẆẊṃọṣṭḃḟḣl·ṁṗṡẋż’"
Notes:
Most of the 1-byte programs print a
0(no-ops / yielding a list with a single zero in, which prints a0), most others print a1(0=0and the like)Ọis the one program which does yield a different byte, but one which is out of range as per the specification - it produces the null-byte (casts the0to character)6produces a space (a literal)7produces a line feed (a literal)Some bytes that do work now may not do so in the future - there are a fair few bytes being reserved (I believe) for niladic values which, when assigned, are almost certainly not going to produce one-byte output.
-
1\$\begingroup\$ Dead link for
byte\$\endgroup\$Weedoze– Weedoze2017年05月17日 11:35:09 +00:00Commented May 17, 2017 at 11:35
-
\$\begingroup\$ Nice. I was about to propose
p p, but didn't think about the newline. \$\endgroup\$Eric Duminil– Eric Duminil2017年05月20日 09:16:16 +00:00Commented May 20, 2017 at 9:16
APL, 2 bytes
-1
Prints ̄1 (the - is the Minus monad, whereas ̄ is the High minus negative indicator).
C#, (削除) 22 (削除ここまで) 16 bytes
()=>$"{1L<<50}";
-6 bytes thanks to Orjan Johansen, using long instead of int.
Outputs
1125899906842624
Alternately, if you allow an arbitrary parameter to be passed into the lambda:
C#, (削除) 21 (削除ここまで) 15 bytes
_=>$"{1L<<49}";
Outputs
562949953421312
-
\$\begingroup\$ If you use long you can do it shorter with only one group:
()=>$"{1L<<50}";. Try it online! \$\endgroup\$Ørjan Johansen– Ørjan Johansen2017年05月17日 23:49:39 +00:00Commented May 17, 2017 at 23:49 -
\$\begingroup\$ Good job on posting such a short C# answer. You can also shave of a byte by using
+""instead of string interpolation. \$\endgroup\$LiefdeWen– LiefdeWen2017年05月18日 08:16:23 +00:00Commented May 18, 2017 at 8:16 -
\$\begingroup\$ Neither
1L<<50+""or""+1L<<50works for me due to<<having lower precedence than+, so would need to add parens making the length the same. \$\endgroup\$milk– milk2017年05月18日 19:37:49 +00:00Commented May 18, 2017 at 19:37 -
2\$\begingroup\$ Why do you include a semicolon? It's not part of the function. \$\endgroup\$LegionMammal978– LegionMammal9782017年05月21日 15:08:56 +00:00Commented May 21, 2017 at 15:08
Cubix, (削除) 6 (削除ここまで) 4 bytes
@"Ou
Cubified
@
" O u .
.
This pushes the string Ou. to the stack, Outputs the top character (.) as a character code (46), does a u-turn to the right, Outputs again, and exits with @.
-
\$\begingroup\$ very nice answer,
@(Ouworks as well \$\endgroup\$MickyT– MickyT2017年05月18日 19:01:05 +00:00Commented May 18, 2017 at 19:01
Excel, 7 bytes
=9^7&""
Produces a 7 digit number and then appends empty string
Uses general idea from pajonk in their answer [although obviously not the language trick :)]
-
1\$\begingroup\$ Welcome to PPCG! I edited your header so that it gets picked up by the leaderboard. :) \$\endgroup\$Martin Ender– Martin Ender2017年05月19日 13:52:13 +00:00Commented May 19, 2017 at 13:52
-
\$\begingroup\$ "Why not just make a 4 digit number?" The challenge states that the function must return a string. It can be checked by
Tfunction whether something is string in Excel - the first solution isn't, the second is. Anyway, upvote as promised. \$\endgroup\$pajonk– pajonk2017年05月20日 16:51:04 +00:00Commented May 20, 2017 at 16:51 -
\$\begingroup\$ @pajonk Great point. I have taken the smaller solution out as I agree it does not meet the conditions. Thanks! \$\endgroup\$OpiesDad– OpiesDad2017年05月20日 21:19:17 +00:00Commented May 20, 2017 at 21:19
NodeJS REPL, 4 bytes
Did someone say REPLs are languages?
*;;;
→ ..._
(the underscore is actually a space character).
For anyone not familiar with the Node REPL, it thinks my program isn't complete, so it's prompting for the rest of the line.
-
\$\begingroup\$ You could also use
!!!0,1e2or""\$\endgroup\$powelles– powelles2017年05月22日 19:48:41 +00:00Commented May 22, 2017 at 19:48
JavaScript (ES6), 9 bytes
_=>""+1E8
Returns 1 * 10^8, or 100000000.
If I can return a number instead of a string, _=>1E5 is 6 bytes.
f=
_=>""+1E8
console.log(f())
-
1\$\begingroup\$ Beat me by a couple of minutes. \$\endgroup\$Steve Bennett– Steve Bennett2017年05月17日 11:32:25 +00:00Commented May 17, 2017 at 11:32
-
1\$\begingroup\$ Some of the Python answers seem to be outputting numbers, so you should be fine doing the same. \$\endgroup\$numbermaniac– numbermaniac2017年05月17日 11:53:30 +00:00Commented May 17, 2017 at 11:53
-
1\$\begingroup\$ @numbermaniac But they print them, which converts them to string. \$\endgroup\$Neil– Neil2017年05月17日 11:57:18 +00:00Commented May 17, 2017 at 11:57
-
\$\begingroup\$ @numbermaniac OP (Martin Ender) told me it was wrong. \$\endgroup\$Stephen– Stephen2017年05月17日 12:29:52 +00:00Commented May 17, 2017 at 12:29
-
\$\begingroup\$
a=b=>b+""9 bytes Include the function name :) \$\endgroup\$Esc Điệp– Esc Điệp2019年10月01日 06:54:39 +00:00Commented Oct 1, 2019 at 6:54
QBasic 4.5, 1 byte
?
This prints nothing. Followed by a newline.
-
1\$\begingroup\$ Thou winneth one internet. \$\endgroup\$Joshua– Joshua2017年05月20日 19:24:09 +00:00Commented May 20, 2017 at 19:24
bash, 48 bytes
bash bash bash bash bash bash! bash! bash! bash!
Output:
/bin/bash: /bin/bash: cannot execute binary file
-
\$\begingroup\$ −1: I downvoted this answer because there are substantially shorter options, for starters e. g. 17 Bytes
echo $((10**15)). \$\endgroup\$Kai Burghardt– Kai Burghardt2024年03月09日 13:49:36 +00:00Commented Mar 9, 2024 at 13:49
JavaScript (ES6), (削除) 17 (削除ここまで) 11 bytes
f=_=>"g="+f
Try it
f=_=>"g="+f
console.log("Function source: f="+f)
console.log("Function length: "+(""+f).length+" + 2 (for variable assignment) = "+((""+f).length+2))
console.log("Function output: "+f())
console.log("Output length: "+f().length)
console.log("Output type: "+typeof f())
Python 2, 10 bytes
print 9**9
Outputs 10 bytes:
387420489
*newline*
There are other 10-byte answers with decimals and power. I like this one for e in the output:
print.3**8
Output:
6.561e-05
*newline*
Same 10 bytes, but for division (there are 5 versions):
.1/64 = 0.0015625
.3/64 = 0.0046875
.5/64 = 0.0078125
.7/64 = 0.0109375
.9/64 = 0.0140625
print.1/64
outputs:
0.0015625
*newline*
-
1\$\begingroup\$ Also works in Cheddar \$\endgroup\$Leaky Nun– Leaky Nun2017年05月17日 11:44:35 +00:00Commented May 17, 2017 at 11:44
-
2\$\begingroup\$ @LeakyNun Why don't you post it as answer? \$\endgroup\$Dead Possum– Dead Possum2017年05月17日 11:46:34 +00:00Commented May 17, 2017 at 11:46
Python 3, 53 bytes
s='s=%r;print("0"*~-len(s%%s))';print("0"*~-len(s%s))
This must be the most quine-like answer ever.
-
1\$\begingroup\$ Why not
print(1e6)? \$\endgroup\$CalculatorFeline– CalculatorFeline2017年05月17日 19:05:15 +00:00Commented May 17, 2017 at 19:05 -
\$\begingroup\$ @CalculatorFeline that would be un-quine-like. \$\endgroup\$Leaky Nun– Leaky Nun2017年05月18日 03:50:36 +00:00Commented May 18, 2017 at 3:50
-
\$\begingroup\$ Your answer should not be a quine. \$\endgroup\$Notts90– Notts902017年05月18日 09:12:44 +00:00Commented May 18, 2017 at 9:12
-
\$\begingroup\$ @Notts90 this isn't a quine. \$\endgroup\$Leaky Nun– Leaky Nun2017年05月18日 09:13:09 +00:00Commented May 18, 2017 at 9:13
dc, 2 bytes
Kp
Pushes the current precision on the stack (which is 0) and prints it with a trailing newline.
-
\$\begingroup\$ dc prints a trailing newline after any command. The command 'c' has no other output, so it works and is one byte shorter \$\endgroup\$Jared K– Jared K2018年03月30日 19:22:16 +00:00Commented Mar 30, 2018 at 19:22
Fourier, 1 byte
o
Note, TIO.run outputs a trailing newline
Outputs the value of the accumulator, 0.
More interesting programs:
2P15o
Outputs 215, 32768.
4^do
Outputs the current year (doesn't work if used before 1000 AD).
999**999o
Outputs 997002999. The ** is undefined behaviour in Fourier. The way I think it works is A**B = A*A*B.
Alice, 5 bytes
g/@O
Prints:
103
g
Explanation
This was quite fun to figure out. :)
g Pop two implicit zeros from the stack and retrieve the code point at that
location in the code. That's the 'g' itself, so we're pushing 103.
/ Reflect to SE. Switch to Ordinal. The IP bounces diagonally up and down
through the code.
O Implicitly convert the 103 to "103" and print it with a trailing linefeed.
Bounce off the top right corner and move back.
/ Reflect to W/ Switch to Cardinal.
g Push 103 again.
The IP wraps back to the last column
O Interpret the 103 as a code point and print the corresponding character.
This prints 'g'.
@ Terminate the program.
AWK, 21 bytes
BEGIN{printf"%21s",0}
Simply prints:
0
The 0 could of course be any digit. No new line is printed, since that would add 2 bytes.
Underload, 6 bytes
()aaaS
Prints ((())).
() pushes an empty string to the stack. a "stringifies" it by wrapping it in (...) so after aaa we get (((()))). S prints that string (without the outermost parentheses, so we get only three pairs).
Perl 5, 9 bytes
print$"x9
Prints 9 spaces, no newline.
Explanation
$" contains a " " by default. x9 uses the repetition operator to "multiply" the string by 9.
-
1\$\begingroup\$ Welcome to PPCG! \$\endgroup\$Martin Ender– Martin Ender2017年05月18日 13:24:47 +00:00Commented May 18, 2017 at 13:24
Powershell, 38 bytes
Just for fun, an answer that returns different output each time it's called.
[System.Guid]::NewGuid().ToString("B")
Prints a GUID surrounded with braces ("B"), such as:
{24cc14a3-ada4-4fcd-8a08-ec419b00f22d}
C (modern Linux), 19 bytes
main(){raise(11);}
Output (with newline):
Segmentation fault
How it works:
SIGSEGV is defined as 11 in /usr/include/asm-generic/signal.h. Therefore, raise(11) raises SIGSEGV, and when SIGSEGV is raised on Linux, all execution stops and Segmentation fault is printed.
20 bytes
main(){raise(2*2);}
Output (with newline):
Illegal instruction
22 bytes
main(){raise(2*3-1);}
Output (with newline):
Trace/breakpoint trap
22 bytes
main(){raise(5*2+5);}
Output (with newline):
User defined signal 1
22 bytes
main(){raise(1?26:0);}
Output (with newline):
Virtual timer expired
24 bytes
main(){raise(12*(1+1));}
Output (with newline):
CPU time limit exceeded
25 bytes
main(){raise(5*5?5*5:0);}
Output (with newline):
File size limit exceeded
25 bytes
main(){printf(raise(8));}
Output (with newline):
Floating point exception
-
1\$\begingroup\$ isn't that first one 18 bytes? \$\endgroup\$Destructible Lemon– Destructible Lemon2017年05月23日 04:28:32 +00:00Commented May 23, 2017 at 4:28
-
\$\begingroup\$ @DestructibleLemon Nope. There's a newline at the end. \$\endgroup\$MD XF– MD XF2017年05月23日 04:29:12 +00:00Commented May 23, 2017 at 4:29
-
1\$\begingroup\$ why isn't the second one 20 bytes then? \$\endgroup\$Destructible Lemon– Destructible Lemon2017年05月23日 04:53:03 +00:00Commented May 23, 2017 at 4:53
-
2\$\begingroup\$ To be pedantic, all of these messages are written by the shell that launched your program, not by your program itself. \$\endgroup\$Anders Kaseorg– Anders Kaseorg2017年05月25日 08:16:18 +00:00Commented May 25, 2017 at 8:16
-
2\$\begingroup\$ @MDXF It really is the shell, not the kernel. You can prove it by running
echo 'main(){raise(11);}' | gcc -xc -; echo ./a.out | strace bash, which showsbashmaking thewritecall. The exact format varies from shell to shell. Here is where the message is defined within the bash source code. You will not find it anywhere in the Linux kernel outside of documentation. \$\endgroup\$Anders Kaseorg– Anders Kaseorg2017年05月25日 20:54:01 +00:00Commented May 25, 2017 at 20:54
Pyramid Scheme, 32 bytes
^ ^
-^-
^-^
-^-
^-^
-^-
^-^
- -
Explanation
This may not look like pyramid scheme but it is. Each triangle looks like:
^
-
This performs one of three operations
If it has 2 args it pairs them together
If it has 1 arg it returns it
If it has 0 args it returns
0
So at the bottom we have two zeros, those are linked on the next level. On the next level two different pyramids grab the pair and then those pairs are paired together. This continues all the way up the pyramid. When we get to the top we have:
((((0,0),(0,0)),((0,0),(0,0))),(((0,0),(0,0)),((0,0),(0,0))))
Pyramid scheme's implicit output converts this to 16 zeros separated by newlines. That's 32 bytes.
Java, 82 bytes
interface M{static void main(String[]a){for(int i=0;i++<82;)System.out.print(1);}}
Output:
1111111111111111111111111111111111111111111111111111111111111111111111111111111111
-
1\$\begingroup\$ Why not a lambda? I admit that it is boring, but I think it could be included to showcase Java 8. \$\endgroup\$Yytsi– Yytsi2017年05月17日 12:10:36 +00:00Commented May 17, 2017 at 12:10
-
1\$\begingroup\$ @TuukkaX I made one! \$\endgroup\$Olivier Grégoire– Olivier Grégoire2017年05月19日 07:30:00 +00:00Commented May 19, 2017 at 7:30
Bash, 1 byte:
#
It sort of outputs a newline...although I don't know if the program gets credit for that or the Bash interpreter.
I'm a bit dubious that this counts, so:
Bash, 21 bytes
x=12345;echo $x$x$x$x
This is really terrible, I know. Are you allowed to call any standard program with Bash?
-
2\$\begingroup\$ codegolf.meta.stackexchange.com/a/7833/56341 languages are denfined by their implementation rather than by their declaration. so your 1 byte solution is perfectly valid \$\endgroup\$Linnea Gräf– Linnea Gräf2017年05月17日 11:53:11 +00:00Commented May 17, 2017 at 11:53
-
1\$\begingroup\$ Ok. I'm still not sure. Calling almost anything from a bash shell will generate a new line, it's not even the interpreter that's looking at my program that does that (I think). It's just that after doing whatever my program does (which is nothing), the Bash shell (which is essentially a REPL) outputs a blank line. \$\endgroup\$Steve Bennett– Steve Bennett2017年05月17日 11:59:27 +00:00Commented May 17, 2017 at 11:59
-
5\$\begingroup\$ It doesn't output anything. What version of Bash are you using? \$\endgroup\$eush77– eush772017年05月17日 12:44:13 +00:00Commented May 17, 2017 at 12:44
-
1\$\begingroup\$
x=12345;echo $x$x$x$xonly outputs 20 characters for a 21 character input. Tryx=1234567;echo $x$x$xalso 21 characters, 21 characters output (123456712345671234567) - oh wait, do we count the implicit\n? does that count as a feature of the program or the shell displaying output? \$\endgroup\$Baldrickk– Baldrickk2017年05月17日 13:21:59 +00:00Commented May 17, 2017 at 13:21 -
1\$\begingroup\$ Run that piped to wc -c and you find it doesn't output anything at all. \$\endgroup\$Joshua– Joshua2017年05月20日 19:22:19 +00:00Commented May 20, 2017 at 19:22
GNU Make, (削除) 24 (削除ここまで) 21 bytes
$(sort $(value $(0)))
returns
$(0))) $(sort $(value
Complete makefile:
X=$(sort $(value $(0)))
$(info $(call X))
-
\$\begingroup\$ How do you invoke this? For me if I put this in a
Makefileand runmake, I getmake: *** No targets. Stop.\$\endgroup\$Digital Trauma– Digital Trauma2017年05月17日 15:56:01 +00:00Commented May 17, 2017 at 15:56 -
\$\begingroup\$ @DigitalTrauma It's a user-defined function. I added the boilerplate to the post. \$\endgroup\$eush77– eush772017年05月17日 16:10:18 +00:00Commented May 17, 2017 at 16:10
-
\$\begingroup\$ Very impressive! +1 \$\endgroup\$MD XF– MD XF2017年05月19日 01:38:42 +00:00Commented May 19, 2017 at 1:38
Pyth, 1 byte
k
It prints a new line character.
Explanation: k is just a variable initialized to '' (empty string), and by default Pyth prints the values of instructions which do nothing, followed by a new line character. In this case, it prints an empty string and then the new line character.
Test it online! (the online interpreter doesn't show the \n, you will have to install Pyth on your computer to actually see it)
Taxi, 540 bytes.
62 is waiting at Starchild Numerology.Go to Starchild Numerology:w 1 l 2 r 1 l 1 l 2 l.Pickup a passenger going to The Underground.Go to The Underground:w 1 r 2 r 1 r 2 l.[r]Switch to plan "e" if no one is waiting.Pickup a passenger going to Cyclone.Go to Cyclone:n 3 l 2 l.Pickup a passenger going to The Babelfishery.Pickup a passenger going to The Underground.Go to The Babelfishery:s 1 l 2 r 1 r.Pickup a passenger going to Post Office.Go to Post Office:n 1 l 1 r.Go to Fueler Up:n 1 r 1 l.Go to The Underground:n.Switch to plan "r".[e]
Ungolfed:
62 is waiting at Starchild Numerology.
Go to Starchild Numerology: west 1st left 2nd right 1st left 1st left 2nd left.
Pickup a passenger going to The Underground.
Go to The Underground: west 1st right 2nd right 1st right 2nd left.
[r]
Switch to plan "e" if no one is waiting.
Pickup a passenger going to Cyclone.
Go to Cyclone: north 3rd left 2nd left.
Pickup a passenger going to The Babelfishery.
Pickup a passenger going to The Underground.
Go to The Babelfishery: south 1st left 2nd right 1st right.
Pickup a passenger going to Post Office.
Go to Post Office: north 1st left 1st right.
Go to Fueler Up: north 1st right 1st left.
Go to The Underground: north.
Switch to plan "r".
[e]
It prints the integers 61 through 1 in descending order and with a decimal and 6 trailing zeros:
61.00000060.00000059.00000058.00000057.00000056.00000055.00000054.00000053.00000052.00000051.00000050.00000049.00000048.00000047.00000046.00000045.00000044.00000043.00000042.00000041.00000040.00000039.00000038.00000037.00000036.00000035.00000034.00000033.00000032.00000031.00000030.00000029.00000028.00000027.00000026.00000025.00000024.00000023.00000022.00000021.00000020.00000019.00000018.00000017.00000016.00000015.00000014.00000013.00000012.00000011.00000010.0000009.0000008.0000007.0000006.0000005.0000004.0000003.0000002.0000001.000000
PowerShell, 2 bytes
+1
The upvote program. This give the output of 1 and a trailing newline to get 2 bytes. I am unsure if the operation is adding 1 to nothing or if it is rendering the positive integer of 1. Either way the result is the same.