问:
"Hello, World!"
So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of <s>Wikipedia</s> (the Wikipedia entry has been deleted but there is a copy at archive.org
), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

The Rules

Each submission must be a full program.

The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.

The program must not write anything to STDERR.

If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.

This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf - these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](https://esolangs.org/wiki/Fish), 121 bytes
</code>```

/* Configuration */

var QUESTION_ID = 55422; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

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) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\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 = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        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(''+lang+'').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, 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.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) 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);
  }

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
  text-align: left !important;
  display: block !important;
}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 500px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Gaot++, <s>1349</s> <s>1167</s> 690 bytes

```<code>baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeeeeet bleeeeeeeeeet baaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleet bleeeeeeeeeeeeet bleeeeeeeeeet baaaaaaaa bleet bleeeeeeeeeeeeet bleeeeeeeeeet bleeeeeeeeeeeeet bleeeeeeeeeet baaaa bleet bleeeeeeeeeet baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeeeeet bleeeeeeeeeeeeet bleeeeeeeeeet baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeet bleet baa bleeet bleeeeeeeeeeeeet bleeeeeeeeeet baaaaaaaaaaaaaa bleet bleeeeeeeeeeeeet baaaaaaaaa bleet bleeeeeeeeeeeeet baaaa bleet bleeeeeeeeeeeeet bleeeeeeeeeet baaaa bleet bleeeeeeeeeet bleeeeeeeeeet bleeeeeeeeeet baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeet
</code>```

Thanks to LeakyNun for having insanely golfed it

Compressed code:

```<code>73a 13e 10e 30a 2e 13e 10e 8a 2e 13e 10e 13e 10e 4a 2e 10e 45a 13e 13e 10e 33a 10e 2e 2a 3e 13e 10e 14a 2e 13e 9a 2e 13e 4a 2e 13e 10e 4a 2e 10e 10e 10e 34a 10e
</code>```

Title: "Hello, World!"

Body:
Gaot++, <s>1349</s> <s>1167</s> 690 bytes

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeeeeet bleeeeeeeeeet baaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleet bleeeeeeeeeeeeet bleeeeeeeeeet baaaaaaaa bleet bleeeeeeeeeeeeet bleeeeeeeeeet bleeeeeeeeeeeeet bleeeeeeeeeet baaaa bleet bleeeeeeeeeet baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeeeeet bleeeeeeeeeeeeet bleeeeeeeeeet baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeet bleet baa bleeet bleeeeeeeeeeeeet bleeeeeeeeeet baaaaaaaaaaaaaa bleet bleeeeeeeeeeeeet baaaaaaaaa bleet bleeeeeeeeeeeeet baaaa bleet bleeeeeeeeeeeeet bleeeeeeeeeet baaaa bleet bleeeeeeeeeet bleeeeeeeeeet bleeeeeeeeeet baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bleeeeeeeeeet

Thanks to LeakyNun for having insanely golfed it

Compressed code:

73a 13e 10e 30a 2e 13e 10e 8a 2e 13e 10e 13e 10e 4a 2e 10e 45a 13e 13e 10e 33a 10e 2e 2a 3e 13e 10e 14a 2e 13e 9a 2e 13e 4a 2e 13e 10e 4a 2e 10e 10e 10e 34a 10e


问:
Print numbers from 1 to 10
This might be a very simple challenge, but I am surprised it hasn't been done on code-golf yet:

Print all Integers from 1 to 10 inclusive in ascending order to standard output.

Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of those, etc., but no digits), and prefixes and postfixes (like [...]). However, you may not output any other numbers than 1 through 10. Your program may not take any input. Standard loopholes are disallowed.

This is code-golf, so shortest answer in bytes wins!

Leaderboard

var QUESTION_ID=86075,OVERRIDE_USER=42570;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="
"+e.body.replace(OVERRIDE_REG,"")+"
")});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;/s.lang?1:e.lang<s.lang?-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;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
TI-BASIC, 9 bytes

```<code>seq(X,X,1,10
</code>```

TI-BASIC is tokenized, so seq( is represented as 1 byte, as are all the other characters. The seq function is actually more powerful: the first X is an expression, and the second X is the variable that is used in the expression using the values 1 to 10, instead of using the predefined variable for X. For example, the squares of the numbers from 1 to 10 would be seq(X²,X,1,10.

ContentLicense: CC BY-SA 3.0

Title: Print numbers from 1 to 10

Body:
TI-BASIC, 9 bytes

seq(X,X,1,10

TI-BASIC is tokenized, so seq( is represented as 1 byte, as are all the other characters. The seq function is actually more powerful: the first X is an expression, and the second X is the variable that is used in the expression using the values 1 to 10, instead of using the predefined variable for X. For example, the squares of the numbers from 1 to 10 would be seq(X²,X,1,10.


答:
JavaScript, 31 bytes

```<code>for(i=1;i<11;i++)console.log(i)
</code>```

Just a for loop that prints the number on every execution. The range of the for loop is 1 to 10.

Title: Print numbers from 1 to 10

Body:
This might be a very simple challenge, but I am surprised it hasn't been done on code-golf yet:

Print all Integers from 1 to 10 inclusive in ascending order to standard output.

Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of those, etc., but no digits), and prefixes and postfixes (like [...]). However, you may not output any other numbers than 1 through 10. Your program may not take any input. Standard loopholes are disallowed.

This is code-golf, so shortest answer in bytes wins!

Leaderboard

var QUESTION_ID=86075,OVERRIDE_USER=42570;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="
"+e.body.replace(OVERRIDE_REG,"")+"
")});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;/s.lang?1:e.lang<s.lang?-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;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

Body:
JavaScript, 31 bytes

for(i=1;i<11;i++)console.log(i)

Just a for loop that prints the number on every execution. The range of the for loop is 1 to 10.


答:
HTML, 44 bytes

```

This is longer than hardcoding the output, but it is more interesting this way. It creates an ordered list (
) with ten empty list elements (
). By default ordered lists are delimited by decimal numbers starting with 1 and a period.

HTML5 is very forgiving regarding unclosed tags, so it closes the li tags implicitly.

Title: Print numbers from 1 to 10

Body:
HTML, 44 bytes

<ol><li><li><li><li><li><li><li><li><li><li>

This is longer than hardcoding the output, but it is more interesting this way. It creates an ordered list (<ol>) with ten empty list elements (<li>). By default ordered lists are delimited by decimal numbers starting with 1 and a period.

HTML5 is very forgiving regarding unclosed tags, so it closes the li tags implicitly.


问:
Write a program that reverses the name of its source file
In a single file, write a program that requires no input and produces no output. When run it should reverse the name of the file it is contained in, regardless of what the name is, without altering the code or producing other lasting side effects.

Any way of achieving this is fine. It only matters that once the program is run the only lasting change is that its file name has been reversed. e.g. no new files should be in the directory.

Running the program again should reverse the name back. Indeed, the program should be able to be run arbitrarily many times.

For the purposes of this challenge:

You may assume filenames are always strings of lowercase letters (a-z) between 1 and 127 characters long. (If your language requires files to have extensions to run then just reverse the part before the extension, e.g. mycode.bat → edocym.bat.)

You may assume the code file is in a directory by itself so it will not have naming conflicts (except with itself).

You may not assume the filename is not a palindrome, i.e. the same when reversed. Filenames that are palindromes should work just as well as those that aren't.

You may read your file's contents or metadata. There are no quine restrictions here.

You may assume your program will be run on a particular, modern, commonplace operating system (e.g. Windows/Linux), since not all shells have the same command set.

As a concrete example, say you have a Python program in a file called
  mycode in its own directory. Running

```<code>python mycode
</code>```

in the terminal should result in the filename being reversed to
  edocym. The file edocym should be alone in its directory - no file
  named mycode should exist anymore. Running

```<code>python edocym
</code>```

will reverse the name back to mycode, at which point the process can
  be repeated indefinitely.

If the same Python file was renamed racecar (without changing the code) and then run

```<code>python racecar
</code>```

nothing should visibly change since "racecar" is a palindrome.
  That same goes if the filename were, say, a or xx.

The shortest code in bytes wins. Tiebreaker is higher voted answer.

Body:
PowerShell, 39 bytes

mi *(-join((ls).name)[-5..-999]+'.ps1')


答:
AutoIt, 45 bytes

```<code>$a=@ScriptName
FileMove($a,StringReverse($a))
</code>```

Title: Write a program that reverses the name of its source file

Body:
In a single file, write a program that requires no input and produces no output. When run it should reverse the name of the file it is contained in, regardless of what the name is, without altering the code or producing other lasting side effects.

Any way of achieving this is fine. It only matters that once the program is run the only lasting change is that its file name has been reversed. e.g. no new files should be in the directory.

Running the program again should reverse the name back. Indeed, the program should be able to be run arbitrarily many times.

For the purposes of this challenge:

You may assume filenames are always strings of lowercase letters (a-z) between 1 and 127 characters long. (If your language requires files to have extensions to run then just reverse the part before the extension, e.g. mycode.bat → edocym.bat.)

You may assume the code file is in a directory by itself so it will not have naming conflicts (except with itself).

You may not assume the filename is not a palindrome, i.e. the same when reversed. Filenames that are palindromes should work just as well as those that aren't.

You may read your file's contents or metadata. There are no quine restrictions here.

You may assume your program will be run on a particular, modern, commonplace operating system (e.g. Windows/Linux), since not all shells have the same command set.

As a concrete example, say you have a Python program in a file called
  mycode in its own directory. Running

```<code>python mycode
</code>```

in the terminal should result in the filename being reversed to
  edocym. The file edocym should be alone in its directory - no file
  named mycode should exist anymore. Running

```<code>python edocym
</code>```

will reverse the name back to mycode, at which point the process can
  be repeated indefinitely.

If the same Python file was renamed racecar (without changing the code) and then run

```<code>python racecar
</code>```

nothing should visibly change since "racecar" is a palindrome.
  That same goes if the filename were, say, a or xx.

The shortest code in bytes wins. Tiebreaker is higher voted answer.

Body:
AutoIt, 45 bytes

$a=@ScriptName
FileMove($a,StringReverse($a))


问:
Render "Digital Clock Style" Numbers
Write the shortest program which will take a string of numbers (of up to at least 20 length) as input, and display the output using the standard digital clock style numbers.  For instance for input 81, a solution with ascii output would give:

```<code> _
|_|  |
|_|  |
</code>```

Graphical output is also acceptable, if it helps.

ContentLicense: CC BY-SA 2.5

Title: Render "Digital Clock Style" Numbers

Body:
Python, 218 180 176

b=map(int,raw_input());a=map(int,bin(914290166014670372457936330)[2:]);c=' |_';p=lambda k:''.join(c[a[9*n+k]]+c[2*a[9*n+1+k]]+c[a[9*n+2+k]]for n in b)+'\n';print p(6)+p(0)+p(3)

With line breaks:

b=map(int,raw_input())
a=map(int,bin(914290166014670372457936330)[2:])
p=lambda k:''.join(' |'[a[9*n+k]]+' _'[a[9*n+1+k]]+' |'[a[9*n+2+k]]for n in b)+'\n'
print p(6)+p(0)+p(3)


问:
Draw the EU Estimated Sign
The specification of the "estimated" sign used by the European Union Directive (U+212e in Unicode, which you may not simply print for this challenge) is quite precise.

To copy some restrictions from this question: Render the symbol to file or screen using vector or raster graphics. If your output is rasterised, your image must have dimensions of 264 pixels × 240 pixels or more. Any other helping lines or length indicators must not be drawn.

答:
GLSL + shadertoy.com, <s>349</s> <s>345</s> 344 bytes

```<code>#define F float
void mainImage(out vec4 R,vec2 C){F S=min(iResolution.x,iResolution.y/0.9);vec2 p=C/vec2(0.5,0.45)/S-1.;F A=0.94-length(p*vec2(1.22,1));F H=min(min(-p.y-0.025,p.y+0.551),p.x);F B=max(length(p)-1.,min(abs(p.y)-0.025,max(A,H)));F D=max(min(p.x,-p.y),max(-A,0.634-abs(p.x)));R=vec4(vec3(max(H,min(B*D*64.-0.01,min(B,D)))*S/3.),1);}
</code>```

Can be tested by pasting the code on this page: https://www.shadertoy.com/new

Output (when the screen size is 1440*900):

Title: Draw the EU Estimated Sign

Body:
GLSL + shadertoy.com, <s>349</s> <s>345</s> 344 bytes

#define F float
void mainImage(out vec4 R,vec2 C){F S=min(iResolution.x,iResolution.y/0.9);vec2 p=C/vec2(0.5,0.45)/S-1.;F A=0.94-length(p*vec2(1.22,1));F H=min(min(-p.y-0.025,p.y+0.551),p.x);F B=max(length(p)-1.,min(abs(p.y)-0.025,max(A,H)));F D=max(min(p.x,-p.y),max(-A,0.634-abs(p.x)));R=vec4(vec3(max(H,min(B*D*64.-0.01,min(B,D)))*S/3.),1);}

Can be tested by pasting the code on this page: https://www.shadertoy.com/new

Output (when the screen size is 1440*900):


问:
Gear Train, Rotating
Gears transfer different amount of speeds, depending on the size of the meshed gear.

Jack has a machine, that rotates a Gear Train. but you don't know the speed of the last gear.

Luckily, You are a great code golfer, so you can help him!

So, What should I do?

Each gear is represented by 2 numbers, the radius of the inner gear and the radius of the outer gears.

If gear A is [a,b] and gear B is [c,d], then the ratio between the speed of A and the speed of B would be c:b.

Given a list of gears (list of 2-tuples), output the speed of the last gear.

You can assume the speed of the first gear is 1.

Worked out example

Let's say our input is [[6,12],[3,10],[5,8]].

The first gear, [6,12], would have a speed of 1.

Then, the second gear, [3,10], would have a speed of 1*12/3 = 4.

Then, the last gear, [5,8], would have a speed of 4*10/5 = 8.

Testcases

```<code>input                    output
[[1,1],[2,2]]            0.5     (1/2)
[[1,2],[1,2],[1,2]]      4       (2/1*2/1)
[[6,12],[3,10],[5,8]]    8       (12/3*10/5)
</code>```

Rules

Basic code-golf rules apply.

答:
JavaScript (ES6), 44 bytes

```<code>a=>(t=1,a.reduce((x,y)=>(t*=x[1]/y[0],y)),t)
</code>```

37 bytes for a flattened array:

```<code>a=>1/a.slice(1,-1).reduce((x,y)=>y/x)
</code>```

Unlike (e.g.) Haskell, reduceRight is such a long name that it's cheaper to reduce the wrong way and take the reciprocal at the end.

Title: Gear Train, Rotating

Body:
JavaScript (ES6), 44 bytes

a=>(t=1,a.reduce((x,y)=>(t*=x[1]/y[0],y)),t)

37 bytes for a flattened array:

a=>1/a.slice(1,-1).reduce((x,y)=>y/x)

Unlike (e.g.) Haskell, reduceRight is such a long name that it's cheaper to reduce the wrong way and take the reciprocal at the end.


答:
Cow, 1539 Bytes

```<code>MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO Moo Moo MoO MoO MoO Moo OOO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo Moo MOo MOo MOo MOo MOo MOo MOo MOo Moo MoO MoO MoO Moo MOo MOo MOo MOo MOo MOo Moo MOo MOo MOo MOo MOo MOo MOo MOo Moo OOO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo
</code>```

ContentLicense: CC BY-SA 4.0

Title: "Hello, World!"

Body:
So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of <s>Wikipedia</s> (the Wikipedia entry has been deleted but there is a copy at archive.org
), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

The Rules

Each submission must be a full program.

The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.

The program must not write anything to STDERR.

If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.

This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf - these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

The Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](https://esolangs.org/wiki/Fish), 121 bytes
</code>```

/* Configuration */

var QUESTION_ID = 55422; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.

/* App */

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) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\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 = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        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(''+lang+'').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, 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.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) 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);
  }

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
  text-align: left !important;
  display: block !important;
}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 500px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

Body:
Cow, 1539 Bytes

MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO Moo Moo MoO MoO MoO Moo OOO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo MOo Moo MOo MOo MOo MOo MOo MOo MOo MOo Moo MoO MoO MoO Moo MOo MOo MOo MOo MOo MOo Moo MOo MOo MOo MOo MOo MOo MOo MOo Moo OOO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO Moo


问:
How much snow did you get?
My apologies for the wordiness. We had fun with it at work in our internal golfing, but it required a few emails for clarification, so I hope I captured most of that the first time.

PROBLEM

Given a “simulated” snowfall snapshot (as a string, stdin or parameter to your function/method), report on 4 values: minimum depth, maximum depth, average depth, and duration.

Here’s a formatted example to illustrate the input:

```<code>* * **
** * ***
** *  *
*
--------
</code>```

The ‘*’ is a snowflake and the ‘-‘ is the ground. Imagine all of those “snowflakes” falling toward the ground. This is the final “snapshot”:

```<code>*
*
** * **
********
--------
</code>```

You need to report on:

Minimum depth - count the shortest “pile” (1, in example above)

Maximum depth - count the tallest “pile” (4, in example above)

Average depth - average count of all “piles” (1.9, in example above - rounding to tenths)

Duration - (each “fall” = 1 second) - time from the first snapshot to the last snapshot (3 seconds, in example above)

Another example for reference:

```<code>     *
   *   *
      *
*
--------
</code>```

Final snapshot:

```<code>*  * ***
--------
</code>```

INPUT

The starting “snapshot” will have 8 “rows”, 8 “columns”, and be pipe-delimited (the pipes separate the rows). For example (excluding quotes):

```<code>“        |        |        |        |     *  |   *   *|      * |*       |--------”
</code>```

OUTPUT

The 4 values pipe-delimited on a single line: 0|1|.6|3 or 0|5|1|1

Title: How much snow did you get?

Body:
JavaScript, 328 Bytes

Not particularly short, but it's what I've got.

var input = "        |        |        |* * **  |        |** * ***|** *  * |*       |--------";

(s=>{var l=s.split("|"),a=[0,0,0,0,0,0,0,0],o=[8,0,0,0],b;for(i=0;i<l.length;i++){if(!b&&l[i]!="        ")o[3]=7-i,b=1;for(j=0;j<l[i].length;j++){a[j]+=l[i][j]=="*"?1:0}}for(i=0;i<a.length;i++){if(a[i]<o[0])o[0]=a[i];if(a[i]>o[1])o[1]=a[i];o[2]+=a[i];}console.log(o[0]+"|"+o[1]+"|"+(o[2]/a.length).toFixed(1)+"|"+o[3]);})(input)

De-golfed:

var input = "        |        |        |        |     *  |   *   *|      * |*       |--------";

(s=>{
  var splits = s.split("|");
  var arr = [0,0,0,0,0,0,0,0];
  var b;
  var o=[8,0,0,0];
  for (var i = 0; i < splits.length; i++) {
    if (!b&&splits[i]!="        ") {
      o[3] = 7-i;b=1;
    }
    for (var j = 0; j < splits[i].length; j++) {
      arr[j]+=splits[i][j]=="*"?1:0;
    }
  }
  for (var i = 0; i < arr.length; i++) {
    if (arr[i]<o[0]) {
      o[0]=arr[i];
    }
    if (arr[i]>o[1]) {
      o[1]=arr[i];
    }
    o[2]+=arr[i];
  }
  console.log(o[0]+"|"+o[1]+"|"+(o[2]/arr.length).toFixed(1)+"|"+o[3]);
})(input)


问:
Substring Sum Set

Introduction

Let's observe this array: [3, 2, 4, 1, 1, 5, 1, 2].

Each element displays the length of the substring which must be summed up. Let's take a look at the first element of the above array:

```<code>[3, 2, 4, 1, 1, 5, 1, 2]
 ^
</code>```

The element at the first index is 3, so we now take a substring of length three with the same index as the starting position:

```<code>[3, 2, 4]
</code>```

When summed up, this results into 9, so the first element of the substring sum set is 9.

We do this for all the elements in the array:

```<code>3 -> [3, 2, 4]
2 -> [2, 4]
4 -> [4, 1, 1, 5]
1 -> [1]
1 -> [1]
5 -> [5, 1, 2]
1 -> [1]
2 -> [2]
</code>```

You can see that the number 5 is a bit of a weird case. That number exceeds the length of the array:

```<code>[3, 2, 4, 1, 1, 5, 1, 2]
                ^  ^  ^  ^  ^
</code>```

We'll ignore everything that exceeds the array, so we just use [5, 1, 2].

The last step is to sum everything up:

```<code>[3, 2, 4]     -> 9
[2, 4]        -> 6
[4, 1, 1, 5]  -> 11
[1]           -> 1
[1]           -> 1
[5, 1, 2]     -> 8
[1]           -> 1
[2]           -> 2
</code>```

And that is the array that needs to be outputted:

```<code>[9, 6, 11, 1, 1, 8, 1, 2]
</code>```

The Task

Given an non-empty array with positive (non-zero) integers, output the substring sum set. This is code-golf, so the submission with the smallest number of bytes wins!

Test cases

```<code>[1, 2, 3, 4, 5] -> [1, 5, 12, 9, 5]
[3, 3, 3, 3, 3, 3, 3, 3] -> [9, 9, 9, 9, 9, 9, 6, 3]
[5, 1, 2, 4, 1] -> [13, 1, 6, 5, 1]
[1] -> [1]
</code>```

答:
q (37 bytes)

```<code>{sum each(til[count x],'x)sublist\:x}
</code>```

Example:

```<code>q){sum each(til[count x],'x)sublist\:x}3 2 4 1 1 5 1 2
9 6 11 1 1 8 1 2
</code>```

Title: Substring Sum Set

Body:
q (37 bytes)

{sum each(til[count x],'x)sublist\:x}

Example:

q){sum each(til[count x],'x)sublist\:x}3 2 4 1 1 5 1 2
9 6 11 1 1 8 1 2


问:
Divisibility test

Task

Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd.

You may write a program or a function and use any of the our standard methods of receiving input and providing output.

The output should be a truthy or a falsy value; truthy if n is divisible by d, and falsy otherwise.

Your code only has to handle integers it can represent natively, as long as it works for all signed 8-bit integers. However, your algorithm has to work for arbitrarily large integers.

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.

Test cases

```<code> n,  d    output

 1,  1    truthy
 2,  1    truthy
 6,  3    truthy
17, 17    truthy
22,  2    truthy
 1,  2    falsy
 2,  3    falsy
 2,  4    falsy
 3,  9    falsy
15, 16    falsy
</code>```

Leaderboard

The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 3 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Java, 13 bytes

```<code>(a,b)->a%b<1;
</code>```

This is a java.util.function.BiPredicate<Integer, Integer>.

As something that makes more sense to those who are new to Java, it takes up 37 bytes:

```<code>boolean A(int b,int B){return b%B<1;}
</code>```

As something that compiles, it takes up 46 bytes:

```<code>class a{boolean A(int b,int B){return b%B<1;}}
</code>```

As something that runs, it takes up 104 bytes:

```<code>interface a{static void main(String[]A){System.out.print(Integer.decode(A[0])%Integer.decode(A[1])<1);}}
</code>```

For the sake of completeness, here's a 50-byte lambda that checks if an arbitrarily large integer a is divisible by another arbitrarily large integer b. It's a BiPredicate<BigInteger, BigInteger>.

```<code>(a,b)->a.mod(b).equals(java.math.BigInteger.ZERO);
</code>```

Title: Divisibility test

Body:
Java, 13 bytes

(a,b)->a%b<1;

This is a java.util.function.BiPredicate<Integer, Integer>.

As something that makes more sense to those who are new to Java, it takes up 37 bytes:

boolean A(int b,int B){return b%B<1;}

As something that compiles, it takes up 46 bytes:

class a{boolean A(int b,int B){return b%B<1;}}

As something that runs, it takes up 104 bytes:

interface a{static void main(String[]A){System.out.print(Integer.decode(A[0])%Integer.decode(A[1])<1);}}

For the sake of completeness, here's a 50-byte lambda that checks if an arbitrarily large integer a is divisible by another arbitrarily large integer b. It's a BiPredicate<BigInteger, BigInteger>.

(a,b)->a.mod(b).equals(java.math.BigInteger.ZERO);


问:
Calculate A190810
Your task is pretty simple, calculate the n-th element of A190810.

Elements of A190810 are calculated according to these rules:

The first element is 1

The sequence is increasing

If x occurs in the sequence, then 2x+1 and 3x-1 also do

You can use 1-based or 0-based indexing, but if you use 0-based indexing, please say it in the answer.

Test cases

```<code>a(1) = 1
a(2) = 2
a(3) = 3
a(4) = 5
a(5) = 7
a(10) = 17
a(20) = 50
a(30) = 95
a(55) = 255
</code>```

Since this is code-golf, the shortest answer in bytes wins!

答:
JavaScript (ES6), 58

n=>(a=>{for(;n;)a[++i]?a[i-~i]=a[3*i-1]=--n:0})([i=0,1])|i
```
<p><em>Less golfed</em></p>
<pre class="lang-js prettyprint-override"><code>n=>{
  a=[];
  a[1] = 1;
  for(i = 0; n;)
  {
    ++i
    if (a[i])
    {
      a[2*i+1] = 1;
      a[3*i-1] = 1;
      --n;
    }
  }
  return i
}
</code>```

Test

About time and memory: element 500000 in ~20 sec and 300MB used by my FireFox 64 bit alpha

F=
n=>(a=>{for(;n;)a[++i]?a[i-~i]=a[3*i-1]=--n:0})([i=0,1])|i

function test() {
  var n=+I.value, t0=+new Date
  O.textContent = F(n)
  console.log((+new Date-t0)/1000,'sec')
}

test()```
<pre class="snippet-code-css lang-css prettyprint-override"><code>#I { width:5em}</code>```

<input id=I type=number value=10 oninput="test()">
```

Title: Calculate A190810

Body:
JavaScript (ES6), 58

n=>(a=>{for(;n;)a[++i]?a[i-~i]=a[3*i-1]=--n:0})([i=0,1])|i

Less golfed

n=>{
  a=[];
  a[1] = 1;
  for(i = 0; n;)
  {
    ++i
    if (a[i])
    {
      a[2*i+1] = 1;
      a[3*i-1] = 1;
      --n;
    }
  }
  return i
}

Test

About time and memory: element 500000 in ~20 sec and 300MB used by my FireFox 64 bit alpha

F=
n=>(a=>{for(;n;)a[++i]?a[i-~i]=a[3*i-1]=--n:0})([i=0,1])|i

function test() {
  var n=+I.value, t0=+new Date
  O.textContent = F(n)
  console.log((+new Date-t0)/1000,'sec')
}

test()

#I { width:5em}

<input id=I type=number value=10 oninput="test()">
<span id=O></span>


问:
Low pass filter
The goal of this challenge is to implement a digital low-pass filter.

You are free to implement any type of digital filter you want, however whatever results produced must pass the validation script below.

Here's a general description of what the validation script expects:

When an FFT is taken of the filtered signal, the filtered signal amplitude at any frequency bucket:

If the input signal has a frequency bucket with a value below -80dB, then the output signal bucket needs only be at or below the -80dB level.

A decade below the cutoff frequency must not differ from the source signal amplitude by more than 3dB at the corresponding frequency bucket.

At or above the cutoff frequency must be at least 3dB below the source signal amplitude at the corresponding frequency bucket of the input signal.

The output signal must be in the time domain and have the same number of samples and sample rate as the input signal.

You need not preserve any phase information or worry about aliasing.

The output signal must consist of only finite real values (no NaN/ infinities).

Input

Your program is given the following inputs:

A time domain sampled signal consisting of real numbers representing the amplitude of the signal at the sample time. Your program will be given the entire sample data at the beginning, but this is not necessarily the same between different runs of your program. You may assume the number of samples is sufficiently small that you don't have to worry about running out of memory. You may assume any single input sample is between [-1, 1]

A positive real number representing the sample rate (in Hz)

A positive real number representing the cutoff frequency (in Hz)

You are free to dictate the exact form of the input as long as no additional information is given (ex.: passing a data pointer+length for the time domain signal is ok, but passing in FFT information is not). The input can come from any source desired (file io, stdio, function parameter, etc.)

Output

Your program should output the time domain filtered signal. The output may be written to any source desired (file io, stdio, function return value, etc.). You should not need the filtered signal sample rate since it should be the same as the input sample rate.

Validation Python function

This should work with Python 2 or 3 (requires NumPy)

```<code>from __future__ import division, print_function
import numpy as np

def validate(original, filtered, srate, cfreq):
    '''
    Validates that the filtered signal meets the minimum requirements of a low-pass filter.
    A message of the failure mode is printed to stdout

    @param original the original signal (numpy array)
    @param filtered the filtered signal (numpy array)
    @param srate the sample rate (float)
    @param cfreq the cutoff frequency (float)
    @return True if filtered signal is sufficent, else False
    '''
    # check length
    if(len(original) != len(filtered)):
        print('filtered signal wrong length')
        print('len(original): %d, len(filtered): %d'%(len(original),len(filtered)))
        return False
    # assert filtered signal is not complex
    if(np.any(np.iscomplex(filtered))):
        print('filtered contains complex values')
        return False
    # assert filtered signal is all finite floats
    if(not np.all(np.isfinite(filtered))):
        print('filtered signal contains non-finite floating point values')
        return False
    o_fft = abs(np.fft.rfft(original))
    f_fft = abs(np.fft.rfft(filtered))
    f_fft /= np.amax(o_fft)
    o_fft /= np.amax(o_fft)
    fft_freqs = np.fft.rfftfreq(len(original), 1/srate)

    orig_small_mask = (o_fft < 1e-4)
    big_mask = ~orig_small_mask
    # check small values
    if(np.any(f_fft[orig_small_mask] > 1e-4)):
        print('input signal had a bucket below -80 dB which the filtered signal did not')
        return False

    ob_fft = o_fft[big_mask]
    fb_fft = f_fft[big_mask]
    fftb_freqs = fft_freqs[big_mask]
    low_mask = (fftb_freqs < 0.1*cfreq)
    high_mask = (fftb_freqs >= cfreq)
    lows = abs(fb_fft[low_mask]/ob_fft[low_mask])
    highs = abs(fb_fft[high_mask]/ob_fft[high_mask])
    # check pass bands
    if(np.any(lows > np.sqrt(2)) or np.any(lows < 1/np.sqrt(2))):
        print('pass region is outside of +/- 3dB')
        return False
    # check filter bands
    if(np.any(highs > 1/np.sqrt(2))):
        print('filter region is not at least -3dB below original')
        return False
    # passed all tests!
    return True
</code>```

Examples

Here are some Python functions which can be used to generate example datasets. Note that these scripts require NumPy. The output of each function is a tuple containing (samples, sample_rate, cutoff_freq). Note that it is very easy to get a different test case by choosing a different cutoff frequency; the example ones are just somewhat "interesting" cases.

from __future__ import division, print_function
import numpy as np
def case1():
    # simple sine wave, cutoff including primary frequency
    t = np.linspace(0, 1, 10000)
    srate = 1/(t[1]-t[0])
    return np.sin(2*pi*t),srate,1

def case2():
    # simple sine wave, cutoff above primary frequency
    t = np.linspace(0, 1, 10000)
    srate = 1/(t[1]-t[0])
    return np.sin(2*pi*t),srate,10

def case3():
    # random noise
    t = np.linspace(0, 1, 10001)
    srate = 1/(t[1]-t[0])
    return np.random.rand(t.size)*2-1,srate,10

def case4():
    # sinc function
    t = np.linspace(-1, 1, 10000)
    srate = 1/(t[1]-t[0])
    return np.sinc(2*np.pi*srate*t), srate, 10

def case5():
    n = 200000
    t = np.linspace(0, 1, n)
    y = np.zeros(t.size)
    for i in range(3):
        amp = np.random.rand(1)
        freq = i*103+101
        phase = np.random.rand(1)*2*np.pi
        tdecay = 1e-3
        decay = 1e-1
        for j in range(1,10):
            fj = freq*j
            if(fj >= 0.9*n):
                break
            y += amp*(np.sin(2*np.pi*fj*t+phase))*np.exp(-decay*(j-1)**2)*np.exp(-tdecay*t)
    y -= np.mean(y)
    y /= max(np.amax(abs(y)),1)
    srate = 1/(t[1]-t[0])
    return y,srate, 1e3
```

Scoring

This is code golf, shortest answer in bytes wins. Standard loop-holes apply. You may use any built-ins desired.

答:
Python: 99 bytes

```<code>from numpy.fft import *
def f(o,s,c):
 a = rfft(o);b=rfftfreq(o.size,1/s);a[b>=c]=0;return irfft(a)
</code>```

This is a very simple rectangle/brick filter. It takes the real fft of the signal, sets all components equal to or higher than the cutoff frequency to 0, then returns the inverse real fft.

Title: Low pass filter

Body:
Python: 99 bytes

from numpy.fft import *
def f(o,s,c):
 a = rfft(o);b=rfftfreq(o.size,1/s);a[b>=c]=0;return irfft(a)

This is a very simple rectangle/brick filter. It takes the real fft of the signal, sets all components equal to or higher than the cutoff frequency to 0, then returns the inverse real fft.


Title: Print numbers from 1 to 10

Body:
Clojure, 20 bytes

(print (range 1 11))

Output:

(1 2 3 4 5 6 7 8 9 10)


Title: Render "Digital Clock Style" Numbers

Body:
Write the shortest program which will take a string of numbers (of up to at least 20 length) as input, and display the output using the standard digital clock style numbers.  For instance for input 81, a solution with ascii output would give:

```<code> _
|_|  |
|_|  |
</code>```

Graphical output is also acceptable, if it helps.

Body:
Ocaml, 268

let t=function|'1'|'4'->"   "|_->" _ "let m=function|'0'->"| |"|'1'|'7'->"  |"|'2'|'3'->" _|"|_->"|_|"|'5'|'6'->"|_ "let b=function|'0'|'8'->"|_|"|'1'|'4'|'7'->"  |"|'2'->"|_ "|_->" _|"let f s=let g h=String.iter(fun c->print_string(h c))s;print_newline()ing t;g m;g b

Readable version

let t = function
  | '1'
  | '4' -> "   "
  | _ -> " _ "
let m = function
  | '0' -> "| |"
  | '1'
  | '7' -> "  |"
  | '2'
  | '3' -> " _|"
  | _ -> "|_|"
  | '5'
  | '6' -> "|_ "
let b = function
  | '0'
  | '8' -> "|_|"
  | '1'
  | '4'
  | '7' -> "  |"
  | '2' -> "|_ "
  | _ -> " _|"
let f s =
  let g h =
    String.iter (fun c -> print_string (h c)) s;
    print_newline () in
  g t;
  g m;
  g b


问:
Shortest infinite loop producing no output
Your task is to create the shortest infinite loop!

The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code might be shorter if no output is given.

Rules

Each submission must be a full program.

You must create the shortest infinite loop.

Even if your program runs out of memory eventually, it is still accepted as long as it is running the whole time from the start to when it runs out of memory. Also when it runs out of memory, it should still not print anything to STDERR.

The program must take no input (however, reading from a file is allowed), and should not print anything to STDOUT. Output to a file is also forbidden.

The program must not write anything to STDERR.

Feel free to use a language (or language version) even if it's newer than this challenge.
-Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. :D

Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.

This is not about finding the language with the shortest infinite loop program. This is about finding the shortest infinite loop program in every language. Therefore, I will not accept an answer.

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainf**k-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

There should be a website such as Wikipedia, Esolangs, or GitHub for the language. For example, if the language is CJam, then one could link to the site in the header like #[CJam](http://sourceforge.net/p/cjam/wiki/Home/), X bytes.

Standard loopholes are not allowed.

(I have taken some of these rules from Martin Büttner's "Hello World" challenge)

Please feel free to post in the comments to tell me how this challenge could be  improved.

Catalogue

This is a Stack Snippet which generates both an alphabetical catalogue of the used languages, and an overall leaderboard. To make sure your answer shows up, please start it with this Markdown header:

```<code># Language name, X bytes
</code>```

Obviously replacing Language name and X bytes with the proper items. If you want to link to the languages' website, use this template, as posted above:

```<code>#[Language name](http://link.to/the/language), X bytes
</code>```

Now, finally, here's the snippet: (Try pressing "Full page" for a better view.)

var QUESTION_ID=59347;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var OVERRIDE_USER=41805;var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=true,comment_page;function answersUrl(index){return"//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"//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){data.items.forEach(function(c){if(c.owner.user_id===OVERRIDE_USER)answers_hash[c.post_id].comments.push(c)});if(data.has_more)getComments();else if(more_answers)getAnswers();else process()}})}getAnswers();var SCORE_REG=/<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\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='
'+c.body.replace(OVERRIDE_REG,'')+'
'});var match=body.match(SCORE_REG);if(match)valid.push({user:getAuthorName(a),size:+match[2],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(''+lang+'').text();languages[lang]=languages[lang]||{lang:a.language,lang_raw:lang,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.toLowerCase()>b.lang_raw.toLowerCase())return 1;if(a.lang_raw.toLowerCase()<b.lang_raw.toLowerCase())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)}}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list{padding:10px;width:500px;float:left}#language-list{padding:10px;padding-right:40px;width:500px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Gaot++, 27 bytes

```<code>bleeeet bleeeeeet bleeeeeet
</code>```

bleeeet enters the loop, and bleeeeeet bleeeeeet switches IP direction repeatedly.

Body:
Gaot++, 27 bytes

bleeeet bleeeeeet bleeeeeet

bleeeet enters the loop, and bleeeeeet bleeeeeet switches IP direction repeatedly.


答:
MATL, 9 bytes

```<code>6L)9L&)/p
</code>```

Input format is any of these:

```<code>[[6,12],[3,10],[5,8]]
[6,12,3,10,5,8]
[6 12 3 10 5 8]
</code>```

EDIT (July 30, 2016): the linked code replaces 9L by 1L to adapt to recent changes in the language.

Try it online!

Explanation

```<code>6L    % Predefined literal: index from second to second-last element
)     % Apply index to implicit input. Removes first and last elements
9L    % Predefined literal: index for elements at odd positions
&)    % Two-output indexing. Gives an array with the odd-position elements
      % and the complementary array, with the even-position elements of the
      % original array
/     % Divide those two arrays element-wise
p     % Product of all entries. Implicitly display
</code>```

Title: Gear Train, Rotating

Body:
Gears transfer different amount of speeds, depending on the size of the meshed gear.

Jack has a machine, that rotates a Gear Train. but you don't know the speed of the last gear.

Luckily, You are a great code golfer, so you can help him!

So, What should I do?

Each gear is represented by 2 numbers, the radius of the inner gear and the radius of the outer gears.

If gear A is [a,b] and gear B is [c,d], then the ratio between the speed of A and the speed of B would be c:b.

Given a list of gears (list of 2-tuples), output the speed of the last gear.

You can assume the speed of the first gear is 1.

Worked out example

Let's say our input is [[6,12],[3,10],[5,8]].

The first gear, [6,12], would have a speed of 1.

Then, the second gear, [3,10], would have a speed of 1*12/3 = 4.

Then, the last gear, [5,8], would have a speed of 4*10/5 = 8.

Testcases

```<code>input                    output
[[1,1],[2,2]]            0.5     (1/2)
[[1,2],[1,2],[1,2]]      4       (2/1*2/1)
[[6,12],[3,10],[5,8]]    8       (12/3*10/5)
</code>```

Rules

Basic code-golf rules apply.

Body:
MATL, 9 bytes

6L)9L&)/p

Input format is any of these:

[[6,12],[3,10],[5,8]]
[6,12,3,10,5,8]
[6 12 3 10 5 8]

EDIT (July 30, 2016): the linked code replaces 9L by 1L to adapt to recent changes in the language.

Try it online!

Explanation

6L    % Predefined literal: index from second to second-last element
)     % Apply index to implicit input. Removes first and last elements
9L    % Predefined literal: index for elements at odd positions
&)    % Two-output indexing. Gives an array with the odd-position elements
      % and the complementary array, with the even-position elements of the
      % original array
/     % Divide those two arrays element-wise
p     % Product of all entries. Implicitly display


问:
Implement a Truth-Machine
A truth-machine (credits goes to this guy for coming up with it) is a very simple program designed to demonstrate the I/O and control flow of a language. Here's what a truth-machine does:

Gets a number (either 0 or 1) from STDIN.

If that number is 0, print out 0 and terminate.

If that number is 1, print out 1 forever.

Challenge

Write a truth-machine as described above in your language of choice. The truth-machine must be a full program that follows these rules:

take input from STDIN or an acceptable alternative

If your language cannot take input from STDIN, it may take input from a hardcoded variable or suitable equivalent in the program

must output to STDOUT or an acceptable alternative

If your language is incapable of outputting the characters 0 or 1, byte or unary I/O is acceptable.

when the input is 1, it must continually print 1s and only stop if the program is killed or runs out of memory

the output must only be either a 0 followed by either one or no newline or space, or infinite 1s with each 1 followed by either one or no newline or space. No other output can be generated, except constant output of your language's interpreter that cannot be suppressed (such as a greeting, ANSI color codes or indentation). Your usage of newlines or spaces must be consistent: for example, if you choose to output 1 with a newline after it all 1s must have a newline after them.

if and only if your language cannot possibly terminate on an input of 0 it is acceptable for the code to enter an infinite loop in which nothing is outputted.

Since this is a catalog, languages created after this challenge are allowed to compete. Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. Other than that, all the standard rules of code-golf must be obeyed. Submissions in most languages will be scored in bytes in an appropriate preexisting encoding (usually UTF-8).

Catalog

The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Gaot++, 125 bytes

```<code>bleeeeeeeeeeet
bleeeet bleeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeet
bleeeeeeeet
</code>```

Compressed: 11e4e6e13e13e13e13e9e8e6e

Try it online!

Title: Implement a Truth-Machine

Body:
Gaot++, 125 bytes

bleeeeeeeeeeet
bleeeet bleeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeet
bleeeeeeeet

Compressed: 11e4e6e13e13e13e13e9e8e6e

Try it online!


问:
Simple cat program
One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after the Unix shell utility cat it is of course much less powerful than the real thing, which is normally used to print (and concatenate) several files read from disc.

Task

You should write a full program which reads the contents of the standard input stream and writes them verbatim to the standard output stream. If and only if your language does not support standard input and/or output streams (as understood in most languages), you may instead take these terms to mean their closest equivalent in your language (e.g. JavaScript's prompt and alert). These are the only admissible forms of I/O, as any other interface would largely change the nature of the task and make answers much less comparable.

The output should contain exactly the input and nothing else. The only exception to this rule is constant output of your language's interpreter that cannot be suppressed, such as a greeting, ANSI color codes or indentation. This also applies to trailing newlines. If the input does not contain a trailing newline, the output shouldn't include one either! (The only exception being if your language absolutely always prints a trailing newline after execution.)

Output to the standard error stream is ignored, so long as the standard output stream contains the expected output. In particular, this means your program can terminate with an error upon hitting the end of the stream (EOF), provided that doesn't pollute the standard output stream. If you do this, I encourage you to add an error-free version to your answer as well (for reference).

As this is intended as a challenge within each language and not between languages, there are a few language specific rules:

If it is at all possible in your language to distinguish null bytes in the standard input stream from the EOF, your program must support null bytes like any other bytes (that is, they have to be written to the standard output stream as well).

If it is at all possible in your language to support an arbitrary infinite input stream (i.e. if you can start printing bytes to the output before you hit EOF in the input), your program has to work correctly in this case. As an example yes | tr -d \\n | ./my_cat should print an infinite stream of ys. It is up to you how often you print and flush the standard output stream, but it must be guaranteed to happen after a finite amount of time, regardless of the stream (this means, in particular, that you cannot wait for a specific character like a linefeed before printing).

Please add a note to your answer about the exact behaviour regarding null-bytes, infinite streams, and extraneous output.

Additional rules

This is not about finding the language with the shortest solution for this (there are some where the empty program does the trick) - this is about finding the shortest solution in every language. Therefore, no answer will be marked as accepted.

Submissions in most languages will be scored in bytes in an appropriate preexisting encoding, usually (but not necessarily) UTF-8.

Some languages, like Folders, are a bit tricky to score. If in doubt, please ask on Meta.

Feel free to use a language (or language version) even if it's newer than this challenge. Languages specifically written to submit a 0-byte answer to this challenge are fair game but not particularly interesting.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

Also note that languages do have to fulfil our usual criteria for programming languages.

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck derivatives like Headsecks or Unary), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

Unless they have been overruled earlier, all standard code-golf rules apply, including the http://meta.codegolf.stackexchange.com/q/1061.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf; these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the author actually had to put effort into golfing the code.

Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Gaot++, 171 bytes

```<code>bleeeeeeeeeeeet
bleeeet bleeeeeet
bleeeeeeeeeet bleeeet blet
bleeeeeeeeeeeet bleeeet blet
bleeeeeeeeeeeeet bleeeet blet
bleeeeeeeeeeeeet bleeeet blet
bleeeeeeeet bleeeeeet
</code>```

Compressed: 12e 4e 6e 10e 4e 1e 12e 4e 1e 13e 4e 1e 13e 4e 1e 8e 6e

Try it online!

Explanation

X 4e 1e, where 1e (blet) is a nop, basically forms a pattern where if you go from left to right, X is executed, but not from right to left.

Alternatively, if you have X 4e Y, then X is executed when you go from left to right, and Y otherwise.

Title: Simple cat program

Body:
Gaot++, 171 bytes

bleeeeeeeeeeeet
bleeeet bleeeeeet
bleeeeeeeeeet bleeeet blet
bleeeeeeeeeeeet bleeeet blet
bleeeeeeeeeeeeet bleeeet blet
bleeeeeeeeeeeeet bleeeet blet
bleeeeeeeet bleeeeeet

Compressed: 12e 4e 6e 10e 4e 1e 12e 4e 1e 13e 4e 1e 13e 4e 1e 8e 6e

Try it online!

Explanation

X 4e 1e, where 1e (blet) is a nop, basically forms a pattern where if you go from left to right, X is executed, but not from right to left.

Alternatively, if you have X 4e Y, then X is executed when you go from left to right, and Y otherwise.


答:
3d, 15 bytes

```<code>>::%v
;!T'_'F!;
</code>```

Takes 2 numbers a and b as input, proceed a mod b, prints T if result is 0, F else. Simple and efficient.

Can be golfable, but since I'm still working on the aforelinked interpreter, I might not come back on it for improvement.

I'm just making a little advertising for my esolang ;)

Title: Divisibility test

Body:
Task

Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd.

You may write a program or a function and use any of the our standard methods of receiving input and providing output.

The output should be a truthy or a falsy value; truthy if n is divisible by d, and falsy otherwise.

Your code only has to handle integers it can represent natively, as long as it works for all signed 8-bit integers. However, your algorithm has to work for arbitrarily large integers.

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.

Test cases

```<code> n,  d    output

 1,  1    truthy
 2,  1    truthy
 6,  3    truthy
17, 17    truthy
22,  2    truthy
 1,  2    falsy
 2,  3    falsy
 2,  4    falsy
 3,  9    falsy
15, 16    falsy
</code>```

Leaderboard

The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 3 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

Body:
3d, 15 bytes

>::%v
;!T'_'F!;

Takes 2 numbers a and b as input, proceed a mod b, prints T if result is 0, F else. Simple and efficient.

Can be golfable, but since I'm still working on the aforelinked interpreter, I might not come back on it for improvement.

I'm just making a little advertising for my esolang ;)


答:
VBA, 118 bytes

```<code>Sub M()
While B<9
B=1-B*(B<>A)
A=A-(B=1)
S=S &B &"x"&A &"="&A*B &IIf(A=B,vbLf,Space(2+(A*B>9)))
Wend
MsgBox S
End Sub
</code>```

No for loops :-) and only one while loop.

And no If statements, so I could potentially one-line it and get the automatic "End Sub" for 8 fewer bytes if pushed; but I'm not that close to the leaderboard :-)

```<code>Sub M():While B<9:B=1-B*(B<>A):A=A-(B=1):S=S &B &"x"&A &"="&A*B &IIf(A=B,vbLf,Space(2+(A*B>9))):Wend:MsgBox S
</code>```

Title: Print this Multiplication Table

Body:
Write shortest code to print the following Multiplication Table:</p>

```<code>1×1=1
1×2=2  2×2=4
1×3=3  2×3=6  3×3=9
1×4=4  2×4=8  3×4=12 4×4=16
1×5=5  2×5=10 3×5=15 4×5=20 5×5=25
1×6=6  2×6=12 3×6=18 4×6=24 5×6=30 6×6=36
1×7=7  2×7=14 3×7=21 4×7=28 5×7=35 6×7=42 7×7=49
1×8=8  2×8=16 3×8=24 4×8=32 5×8=40 6×8=48 7×8=56 8×8=64
1×9=9  2×9=18 3×9=27 4×9=36 5×9=45 6×9=54 7×9=63 8×9=72 9×9=81
</code>```

Body:
VBA, 118 bytes

Sub M()
While B<9
B=1-B*(B<>A)
A=A-(B=1)
S=S &B &"x"&A &"="&A*B &IIf(A=B,vbLf,Space(2+(A*B>9)))
Wend
MsgBox S
End Sub

No for loops :-) and only one while loop.

And no If statements, so I could potentially one-line it and get the automatic "End Sub" for 8 fewer bytes if pushed; but I'm not that close to the leaderboard :-)

Sub M():While B<9:B=1-B*(B<>A):A=A-(B=1):S=S &B &"x"&A &"="&A*B &IIf(A=B,vbLf,Space(2+(A*B>9))):Wend:MsgBox S


问:
Catalan Numbers
The Catalan numbers (OEIS) are a sequence of natural numbers often appearing in combinatorics.

The nth Catalan number is the number of Dyck words (balanced strings of parenthesis or brackets such as [[][]]; formally defined as a string using two characters a and b such that any substring starting from the beginning has number of a characters greater than or equal to number of b characters, and the entire string has the same number of a and b characters) with length 2n. The nth Catalan number (for \$n\ge0\$) is also explicitly defined as:
$$C_n=\frac1{n+1}\binom{2n}n$$
Starting from \$n=0\$, the first 20 Catalan numbers are:

```<code>1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845, 35357670, 129644790, 477638700, 1767263190...
</code>```

Challenge

Write a full program or function that takes a non-negative integer n via STDIN or an acceptable alternative, and outputs the nth Catalan number. Your program must work at minimum for inputs 0-19.

I/O

Input

Your program must take input from STDIN, function arguments or any of the acceptable alternatives per this meta post. You can read the inputted number as its standard decimal represention, unary representation, or bytes.

If (and only if) your language cannot take input from STDIN or any acceptable alternative, it may take input from a hardcoded variable or suitable equivalent in the program.

Output

Your program must output the nth Catalan number to STDOUT, function result or any of the acceptable alternatives per this meta post. You can output the Catalan number in its standard decimal representation, unary representation or bytes.

The output should consist of the approriate Catalan number, optionally followed by one or more newlines. No other output can be generated, except constant output of your language's interpreter that cannot be suppressed (such as a greeting, ANSI color codes or indentation).

This is not about finding the language that is the shortest. This is about finding the shortest program in every language. Therefore, I will not accept an answer.

In this challenge, languages newer than the challenge are acceptable as long as they have an implementation. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. Other than that, all the standard rules of code-golf must be obeyed. Submissions in most languages will be scored in bytes in an appropriate preexisting encoding (usually UTF-8). Note also that built-ins for calculating the nth Catalan number are allowed.

Catalog

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Sesos, <s>94</s> <s>86</s> 68 bytes

8 bytes by changing the factorial-er from version 1 to version 2.

18 bytes by computing n!(n+1)! in one step. Largely inspired by Dennis' primality test algorithm.

Hexdump:

```<code>0000000: 16f8de a59f17 a0ebba 7f4cd3 e05f3f cf0fd0 a0ebde  ..........L.._?......
0000015: b1c1bb 76fe18 8cc1bb 76fe1c e0fbda 390fda bde3d8  ...v.....v.....9.....
000002a: 000fbe af9d1b b47bc7 cfc11c b47bc7 cff1fa e07bda  .......{.....{.....{.
000003f: 39e83e cf07                                       9.>..
</code>```

Try it online!

Uses the formula a(n) = (2n)! / (n!(n+1)!).

The factorial-er: version 1 (in-place, constant memory), version 2 (in-place, linear memory)

The multiplier: here (in place, constant memory)

The divider: here (does not halt if not divisible)

Assembler

set numin
set numout
get
jmp,sub 1,fwd 1,add 1,fwd 2,add 2,rwd 3,jnz
fwd 1,add 1
jmp
  jmp,sub 1,rwd 1,add 1,rwd 1,add 1,rwd 1,add 1,fwd 3,jnz
  rwd 1,sub 1,rwd 1,sub 1,rwd 1
  jmp,sub 1,fwd 3,add 1,rwd 3,jnz
  fwd 1
jnz
fwd 3
jmp
  jmp
    sub 1,rwd 1
    jmp,sub 1,rwd 1,add 1,rwd 1,add 1,fwd 2,jnz
    rwd 2
    jmp,sub 1,fwd 2,add 1,rwd 2,jnz
    fwd 3
  jnz
  rwd 1
  jmp,sub 1,jnz
  rwd 1
  jmp,sub 1,fwd 2,add 1,rwd 2,jnz
  fwd 3
jnz
fwd 1
jmp
  jmp,sub 1,fwd 1,add 1,fwd 1,add 1,rwd 2,jnz
  fwd 1,sub 1,fwd 1
  jmp,sub 1,rwd 2,add 1,fwd 2,jnz
  rwd 1
jnz
rwd 2
jmp
  jmp
    sub 1,fwd 1
    jmp,sub 1,fwd 1,add 1,fwd 1,add 1,rwd 2,jnz
    fwd 2
    jmp,sub 1,rwd 2,add 1,fwd 2,jnz
    rwd 3
  jnz
  fwd 1
  jmp,sub 1,jnz
  fwd 1
  jmp,sub 1,rwd 2,add 1,fwd 2,jnz
  rwd 3
jnz
fwd 1
jmp
  fwd 1,add 1,rwd 3
  jmp,sub 1,fwd 1,add 1,fwd 1,sub 1,rwd 2,jnz
  fwd 1
  jmp,sub 1,rwd 1,add 1,fwd 1,jnz
  fwd 1
jnz
fwd 1
put
```

<h2>Brainfuck equivalent</h2>

<p>This Retina script is used to generate the brainfuck equivalent. Note that it only accepts one digit as command argument, and does not check if a command is in the comments.</p>

```[->+>>++<<<]>+
[[-<+<+<+>>>]<-<-<[->>>+<<<]>]>>>
[[-<[-<+<+>>]<<[->>+<<]>>>]<[-]<[->>+<<]>>>]>
[[->+>+<<]>->[-<<+>>]<]<<
[[->[->+>+<<]>>[-<<+>>]<<<]>[-]>[-<<+>>]<<<]>
[>+<<<[->+>-<<]>[-<+>]>]>
```

Title: Catalan Numbers

Body:
Sesos, <s>94</s> <s>86</s> 68 bytes

8 bytes by changing the factorial-er from version 1 to version 2.

18 bytes by computing n!(n+1)! in one step. Largely inspired by Dennis' primality test algorithm.

Hexdump:

0000000: 16f8de a59f17 a0ebba 7f4cd3 e05f3f cf0fd0 a0ebde  ..........L.._?......
0000015: b1c1bb 76fe18 8cc1bb 76fe1c e0fbda 390fda bde3d8  ...v.....v.....9.....
000002a: 000fbe af9d1b b47bc7 cfc11c b47bc7 cff1fa e07bda  .......{.....{.....{.
000003f: 39e83e cf07                                       9.>..

<a href="http://sesos.tryitonline.net/#code=c2V0IG51bWluCnNldCBudW1vdXQKZ2V0CmptcCxzdWIgMSxmd2QgMSxhZGQgMSxmd2QgMixhZGQgMixyd2QgMyxqbnoKZndkIDEsYWRkIDEKam1wCiAgam1wLHN1YiAxLHJ3ZCAxLGFkZCAxLHJ3ZCAxLGFkZCAxLHJ3ZCAxLGFkZCAxLGZ3ZCAzLGpuegogIHJ3ZCAxLHN1YiAxLHJ3ZCAxLHN1YiAxLHJ3ZCAxCiAgam1wLHN1YiAxLGZ3ZCAzLGFkZCAxLHJ3ZCAzLGpuegogIGZ3ZCAxCmpuegpmd2QgMwpqbXAKICBqbXAKICAgIHN1YiAxLHJ3ZCAxCiAgICBqbXAsc3ViIDEscndkIDEsYWRkIDEscndkIDEsYWRkIDEsZndkIDIsam56CiAgICByd2QgMgogICAgam1wLHN1YiAxLGZ3ZCAyLGFkZCAxLHJ3ZCAyLGpuegogICAgZndkIDMKICBqbnoKICByd2QgMQogIGptcCxzdWIgMSxqbnoKICByd2QgMQogIGptcCxzdWIgMSxmd2QgMixhZGQgMSxyd2QgMixqbnoKICBmd2QgMwpqbnogCmZ3ZCAxCmptcAogIGptcCxzdWIgMSxmd2QgMSxhZGQgMSxmd2QgMSxhZGQgMSxyd2QgMixqbnoKICBmd2QgMSxzdWIgMSxmd2QgMQogIGptcCxzdWIgMSxyd2QgMixhZGQgMSxmd2QgMixqbnoKICByd2QgMQpqbnoKcndkIDIKam1wCiAgam1wCiAgICBzdWIgMSxmd2QgMQogICAgam1wLHN1YiAxLGZ3ZCAxLGFkZCAxLGZ3ZCAxLGFkZCAxLHJ3ZCAyLGpuegogICAgZndkIDIKICAgIGptcCxzdWIgMSxyd2QgMixhZGQgMSxmd2QgMixqbnoKICAgIHJ3ZCAzCiAgam56CiAgZndkIDEKICBqbXAsc3ViIDEsam56CiAgZndkIDEKICBqbXAsc3ViIDEscndkIDIsYWRkIDEsZndkIDIsam56CiAgcndkIDMKam56IApmd2QgMQpqbXAKICBmd2QgMSxhZGQgMSxyd2QgMwogIGptcCxzdWIgMSxmd2QgMSxhZGQgMSxmd2QgMSxzdWIgMSxyd2QgMixqbnoKICBmd2QgMQogIGptcCxzdWIgMSxyd2QgMSxhZGQgMSxmd2QgMSxqbnoKICBmd2QgMQpqbnoKZndkIDEKcHV0&input=NA&debug=on" rel="nofollow noreferrer">Try it online!

Uses the formula a(n) = (2n)! / (n!(n+1)!).

The factorial-er: <a href="http://sesos.tryitonline.net/#code=c2V0IG51bWluCnNldCBudW1vdXQKZ2V0CmptcCxzdWIgMSxmd2QgMSxhZGQgMSxmd2QgMSxhZGQgMSxyd2QgMixqbnoKZndkIDMKYWRkIDEKcndkIDIKam1wCiAgc3ViIDEKICBmd2QgMQogIGptcAogICAgc3ViIDEKICAgIGZ3ZCAxCiAgICBqbXAKICAgICAgc3ViIDEsZndkIDEsYWRkIDEsZndkIDEsYWRkIDEscndkIDIKICAgIGpuegogICAgZndkIDEKICAgIGptcAogICAgICBzdWIgMSxyd2QgMSxhZGQgMSxmd2QgMQogICAgam56CiAgICByd2QgMgogIGpuegogIGZ3ZCAxLGptcCxzdWIgMSxqbnoKICByd2QgMgogIGptcCxzdWIgMSxmd2QgMixhZGQgMSxyd2QgMixqbnoKICBmd2QgMgogIGptcCxzdWIgMSxyd2QgMSxhZGQgMSxyd2QgMSxhZGQgMSxmd2QgMixqbnoKICBmd2QgMgogIGptcCxzdWIgMSxyd2QgMixhZGQgMSxmd2QgMixqbnoKICByd2QgNApqbnoKZndkIDIKcHV0&input=NQ&debug=on" rel="nofollow noreferrer">version 1 (in-place, constant memory), <a href="http://sesos.tryitonline.net/#code=c2V0IG51bWluCnNldCBudW1vdXQKZ2V0CmptcAogIGptcCxzdWIgMSxmd2QgMixhZGQgMSxyd2QgMixqbnoKICBmd2QgMgogIGptcCxzdWIgMSxyd2QgMSxhZGQgMSxyd2QgMSxhZGQgMSxmd2QgMixqbnoKICByd2QgMQogIHN1YiAxCmpuegpyd2QgMgpqbXAKICBqbXAKICAgIHN1YiAxLGZ3ZCAxCiAgICBqbXAsc3ViIDEsZndkIDEsYWRkIDEsZndkIDEsYWRkIDEscndkIDIsam56CiAgICBmd2QgMQogICAgam1wLHN1YiAxLHJ3ZCAxLGFkZCAxLGZ3ZCAxLGpuegogICAgcndkIDIKICBqbnoKICBmd2QgMSxqbXAsc3ViIDEsam56LGZ3ZCAyCiAgam1wLHN1YiAxLHJ3ZCAzLGFkZCAxLGZ3ZCAzLGpuegogIHJ3ZCA0Cmpuegpmd2QgMQpwdXQ&input=NQ&debug=on" rel="nofollow noreferrer">version 2 (in-place, linear memory)

The multiplier: here (in place, constant memory)

The divider: here (does not halt if not divisible)

Assembler

set numin
set numout
get
jmp,sub 1,fwd 1,add 1,fwd 2,add 2,rwd 3,jnz
fwd 1,add 1
jmp
  jmp,sub 1,rwd 1,add 1,rwd 1,add 1,rwd 1,add 1,fwd 3,jnz
  rwd 1,sub 1,rwd 1,sub 1,rwd 1
  jmp,sub 1,fwd 3,add 1,rwd 3,jnz
  fwd 1
jnz
fwd 3
jmp
  jmp
    sub 1,rwd 1
    jmp,sub 1,rwd 1,add 1,rwd 1,add 1,fwd 2,jnz
    rwd 2
    jmp,sub 1,fwd 2,add 1,rwd 2,jnz
    fwd 3
  jnz
  rwd 1
  jmp,sub 1,jnz
  rwd 1
  jmp,sub 1,fwd 2,add 1,rwd 2,jnz
  fwd 3
jnz
fwd 1
jmp
  jmp,sub 1,fwd 1,add 1,fwd 1,add 1,rwd 2,jnz
  fwd 1,sub 1,fwd 1
  jmp,sub 1,rwd 2,add 1,fwd 2,jnz
  rwd 1
jnz
rwd 2
jmp
  jmp
    sub 1,fwd 1
    jmp,sub 1,fwd 1,add 1,fwd 1,add 1,rwd 2,jnz
    fwd 2
    jmp,sub 1,rwd 2,add 1,fwd 2,jnz
    rwd 3
  jnz
  fwd 1
  jmp,sub 1,jnz
  fwd 1
  jmp,sub 1,rwd 2,add 1,fwd 2,jnz
  rwd 3
jnz
fwd 1
jmp
  fwd 1,add 1,rwd 3
  jmp,sub 1,fwd 1,add 1,fwd 1,sub 1,rwd 2,jnz
  fwd 1
  jmp,sub 1,rwd 1,add 1,fwd 1,jnz
  fwd 1
jnz
fwd 1
put

Brainfuck equivalent

<a href="http://retina.tryitonline.net/#code=TSFgKFtmcl13ZHxhZGR8c3ViKSBcZHxqbnp8am1wfGpuZXxub3AKam1wClsKam56Cl0Kc3ViIChcZCkKJDEkKi0KYWRkIChcZCkKJDEkKisKZndkIChcZCkKJDEkKj4KcndkIChcZCkKJDEkKjwKwrYK&input=c2V0IG51bWluCnNldCBudW1vdXQKZ2V0CmptcCxzdWIgMSxmd2QgMSxhZGQgMSxmd2QgMixhZGQgMixyd2QgMyxqbnoKZndkIDEsYWRkIDEKam1wCiAgam1wLHN1YiAxLHJ3ZCAxLGFkZCAxLHJ3ZCAxLGFkZCAxLHJ3ZCAxLGFkZCAxLGZ3ZCAzLGpuegogIHJ3ZCAxLHN1YiAxLHJ3ZCAxLHN1YiAxLHJ3ZCAxCiAgam1wLHN1YiAxLGZ3ZCAzLGFkZCAxLHJ3ZCAzLGpuegogIGZ3ZCAxCmpuegpmd2QgMwpqbXAKICBqbXAKICAgIHN1YiAxLHJ3ZCAxCiAgICBqbXAsc3ViIDEscndkIDEsYWRkIDEscndkIDEsYWRkIDEsZndkIDIsam56CiAgICByd2QgMgogICAgam1wLHN1YiAxLGZ3ZCAyLGFkZCAxLHJ3ZCAyLGpuegogICAgZndkIDMKICBqbnoKICByd2QgMQogIGptcCxzdWIgMSxqbnoKICByd2QgMQogIGptcCxzdWIgMSxmd2QgMixhZGQgMSxyd2QgMixqbnoKICBmd2QgMwpqbnogCmZ3ZCAxCmptcAogIGptcCxzdWIgMSxmd2QgMSxhZGQgMSxmd2QgMSxhZGQgMSxyd2QgMixqbnoKICBmd2QgMSxzdWIgMSxmd2QgMQogIGptcCxzdWIgMSxyd2QgMixhZGQgMSxmd2QgMixqbnoKICByd2QgMQpqbnoKcndkIDIKam1wCiAgam1wCiAgICBzdWIgMSxmd2QgMQogICAgam1wLHN1YiAxLGZ3ZCAxLGFkZCAxLGZ3ZCAxLGFkZCAxLHJ3ZCAyLGpuegogICAgZndkIDIKICAgIGptcCxzdWIgMSxyd2QgMixhZGQgMSxmd2QgMixqbnoKICAgIHJ3ZCAzCiAgam56CiAgZndkIDEKICBqbXAsc3ViIDEsam56CiAgZndkIDEKICBqbXAsc3ViIDEscndkIDIsYWRkIDEsZndkIDIsam56CiAgcndkIDMKam56IApmd2QgMQpqbXAKICBmd2QgMSxhZGQgMSxyd2QgMwogIGptcCxzdWIgMSxmd2QgMSxhZGQgMSxmd2QgMSxzdWIgMSxyd2QgMixqbnoKICBmd2QgMQogIGptcCxzdWIgMSxyd2QgMSxhZGQgMSxmd2QgMSxqbnoKICBmd2QgMQpqbnoKZndkIDEKcHV0" rel="nofollow noreferrer">This Retina script is used to generate the brainfuck equivalent. Note that it only accepts one digit as command argument, and does not check if a command is in the comments.

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


问:
Illustrate music beats
You know—they look like this:

source

The goal is to draw a music beats illustration like the following:

```<code>=     =      =
=  =  =      =          =
== = ==   =  ==     = ====
== ====  == ===   = = =======
======== == ====  = ========= =
=================================
</code>```

The rules are:

The width of the illustration is 33 symbols, but if you need—any trailing spaces exceeding this width are allowed.

Each column is made of equals signs (=).

Each column has a random height (the height of the next column shouldn’t depend in any way on the height of the previous column), varying from 1 to 6. It’s also fine if it’s at least possible to get some input with no strict math probability (i.e. some inputs could appear more rarely than others).

A column can’t float above the bottom and have gaps in it.

Since every column has the minimal height of 1, the last row can’t have any gaps either—it always consists of 33 equals signs.

Since it’s possible to have no columns with the height of 6 (it’s all random after all): in this case you don’t need to have a top line made of spaces. Applies to any edge cases of this nature: if suddenly your code provided no columns with the height greater than 1, you don’t need to have additional lines made of spaces above the bottom line.

You don’t take any input.

答:
JavaScript, 165 Bytes

```<code>// function that fills a column with a specified number of = signs
m=l=>Array(6).fill``.map((e,i)=>i<l?"=":" ");
// fill an array of 33 length with columns of random number of = signs
a=Array(33).fill``.map(e=>m(Math.ceil(Math.random()*6)));
// transponse the rows and columns and print to console
a[0].map((c,i)=>a.map(r=>r[5-i])).map(r=>console.log(r.join``))
</code>```

The newlines are unnecessary but they make it easier to see what's going on. Not the most optimal solution, but it makes sense to me at least.

Title: Illustrate music beats

Body:
JavaScript, 165 Bytes

// function that fills a column with a specified number of = signs
m=l=>Array(6).fill``.map((e,i)=>i<l?"=":" ");
// fill an array of 33 length with columns of random number of = signs
a=Array(33).fill``.map(e=>m(Math.ceil(Math.random()*6)));
// transponse the rows and columns and print to console
a[0].map((c,i)=>a.map(r=>r[5-i])).map(r=>console.log(r.join``))

The newlines are unnecessary but they make it easier to see what's going on. Not the most optimal solution, but it makes sense to me at least.


答:
JavaScript, <s>59</s> <s>58</s> 56 bytes

```<code>a=>a.reduce((p,c)=>p*c[1]/c[0],a[0][0]/a[a.length-1][1])
</code>```

Explanation

Reduce the array and multiply by every second value and divide by every first value. So for [[6,12],[3,10],[5,8]] it does 12/6*10/3*8/5. Of course, the actual computation we wanted was 12/3*10/5 so we just want to ignore that first /6 and last *8 by multiplying *6 back in and dividing /8 back out. That cancelling out is done by setting 6/8 as the initial value for the reduce.

Title: Gear Train, Rotating

Body:
JavaScript, <s>59</s> <s>58</s> 56 bytes

a=>a.reduce((p,c)=>p*c[1]/c[0],a[0][0]/a[a.length-1][1])

Explanation

Reduce the array and multiply by every second value and divide by every first value. So for [[6,12],[3,10],[5,8]] it does 12/6*10/3*8/5. Of course, the actual computation we wanted was 12/3*10/5 so we just want to ignore that first /6 and last *8 by multiplying *6 back in and dividing /8 back out. That cancelling out is done by setting 6/8 as the initial value for the reduce.