答:
Python, 48 bytes

f=lambda l:l==[]or len(l)*f(l[1:])/l.count(l[0])
```
<p>A recursive implementation.</p>
<p>In the formula, <code>n! / (n_1! * n_2! * ...)</code>, if we remove the first element (say it's <code>1</code>), the number of permutation for the remaining <code>n-1</code> elements is</p>
```(n-1)! / ((n_1-1)! * n_2! * ...) ==
n! / n / (n_1! / n_1! * n_2! * ...) ==
n/n_1 * (n! / (n_1! * n_2! * ...)`)
```

So, we get the answer by multiplying by n/n1, the reciprocal-fraction of elements that equal the first one, by the recursive result for the rest of the list. The empty list gives the base case of 1.

Body:
Python, 48 bytes

f=lambda l:l==[]or len(l)*f(l[1:])/l.count(l[0])

A recursive implementation.

In the formula, n! / (n_1! * n_2! * ...), if we remove the first element (say it's 1), the number of permutation for the remaining n-1 elements is

(n-1)! / ((n_1-1)! * n_2! * ...) ==
n! / n / (n_1! / n_1! * n_2! * ...) ==
n/n_1 * (n! / (n_1! * n_2! * ...)`)

So, we get the answer by multiplying by n/n1, the reciprocal-fraction of elements that equal the first one, by the recursive result for the rest of the list. The empty list gives the base case of 1.


问:
Permutations with Indistinguishable Items
Given a list of integers, output the number of permutations of the integers, with indistinguishable permutations counted once. If there are n integers, and each group of indistinguishable numbers has length n_i, this is n! / (n_1! * n_2! * ...)

Rules

Input will be some form of list as arguments to a function or the program with 1 to 12 non-negative integers.

Output will be printing or returning the number of permutations as described above.

No standard loopholes or built-in functions (generating permutations, combinations, etc.). Factorials are allowed.

Test Cases

Inputs:

```<code>1, 3000, 2, 2, 8
1, 1, 1
2, 4, 3, 2, 3, 4, 4, 4, 4, 4, 1, 1
</code>```

Outputs:

```<code>60
1
83160
</code>```

答:
JavaScript (ES6), <s>64</s> 61 bytes

```<code>a=>a.sort().map((x,i)=>r=r*++i/(x-y?(y=x,c=1):++c),y=r=-1)|-r
</code>```

Uses the formula given, except calculating each factorial incrementally (so for example the r=r*++i effectively calcluates n!).

Edit: Originally I accepted any finite numbers but I saved 3 bytes when @user81655 pointed out that I only needed to support positive integers (although I actually accept non-negative integers).

ContentLicense: CC BY-SA 3.0

Body:
JavaScript (ES6), <s>64</s> 61 bytes

a=>a.sort().map((x,i)=>r=r*++i/(x-y?(y=x,c=1):++c),y=r=-1)|-r

Uses the formula given, except calculating each factorial incrementally (so for example the r=r*++i effectively calcluates n!).

Edit: Originally I accepted any finite numbers but I saved 3 bytes when @user81655 pointed out that I only needed to support positive integers (although I actually accept non-negative integers).


问:
Watson-Crick palindromes

Problem

Create a function that can determine whether or not an arbitrary DNA string is a Watson-Crick palindrome. The function will take a DNA string and output a true  value if the string is a Watson-Crick palindrome and a false value if it is not. (True and False can also be represented as 1 and 0, respectively.)

The DNA string may either be in all uppercase or all lowercase depending on your preference.

Also, the DNA string will not be empty.

Explanation

A DNA string is a Watson-Crick palindrome when the complement of its reverse is equal to itself.

Given a DNA string, first reverse it, and then complement each character according to the DNA bases (A ↔ T and C ↔ G). If the original string is equal to the complemented-reverse string, it is a Watson-Crick palindrome.

For more, see this question. It is a different challenge where you must find the longest substring of a DNA string where that substring is a Watson-Crick palindrome.

Goal

This is code-golf and the shortest code wins.

Test Cases

The format is <input> = <output>.

```<code>ATCGCGAT = true
AGT = false
GTGACGTCAC = true
GCAGTGA = false
GCGC = true
AACTGCGTTTAC = false
ACTG = false
</code>```

答:
Pyth - 10 bytes

```<code>qQ_XQ"ACGT
</code>```

Try it online here.

A 9 byte version: Try it online here.

Title: Watson-Crick palindromes

Body:
Pyth - 10 bytes

qQ_XQ"ACGT

Try it online here.

A 9 byte version: Try it online here.

ContentLicense: CC BY-SA 4.0


问:
Driftsort an array
Driftsort is a simple way to "sort" an array. It works by "sliding" or "rotating" the elements over in the array until the array is sorted, or until the array fails to be sorted.

Let's walk through two examples. First, consider the array [10, 2, 3, 4, 7]. Since the array is not sorted, we rotate it once. (This can happen in either direction, so long as it remains the same direction.) Then, the array becomes:

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

This is not sorted, so we rotate again.

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

And again:

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

And a final time:

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

And it's sorted! So the array [10, 2, 3, 4, 7] is driftsortable. Here are all the rotations of the array, for clarity:

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

Consider now the array [5, 3, 9, 2, 6, 7]. Look at its rotations:

```<code>[5, 3, 9, 2, 6, 7]
[7, 5, 3, 9, 2, 6]
[6, 7, 5, 3, 9, 2]
[2, 6, 7, 5, 3, 9]
[9, 2, 6, 7, 5, 3]
[3, 9, 2, 6, 7, 5]
</code>```

None of these arrays are sorted, so the array [5, 3, 9, 2, 6, 7] is not driftsortable.

Objective Given a nonempty array/list of integers as input to a program/function, implement driftsort on the input and output it, or output a falsey value (or an empty array/list) if it cannot be driftsorted. The integers are bound to your languages max/min, but this must be at least 255 for the max, and 0 for the min.

You may use built-in sorting methods, but not a built-in which solves the challenge.

This is a code-golf, so the shortest program in bytes.

Test cases

```<code>input => output
[1] => [1]
[5, 0, 5] => [0, 5, 5]
[3, 2, 1] => false
[0, 9, 3] => false
[1, 2, 3, 4] => [1, 2, 3, 4]
[4, 1, 2, 3] => [1, 2, 3, 4]
[0, 2, 0, 2] => false
[5, 3, 9, 2, 6, 7] => false
[0, 0, 0, 0, 0, 0, 0] => [0, 0, 0, 0, 0, 0, 0]
[75, 230, 30, 42, 50] => [30, 42, 50, 75, 230]
[255, 255, 200, 200, 203] => [200, 200, 203, 255, 255]
</code>```

答:
Python, 53 bytes

```<code>s,N=sorted,lambda x:s(x)*(str(s(x))[1:-1]in str(x+x))
</code>```

If you want to test this head over to https://www.repl.it/languages/python3 and copy paste this:

```<code>s,N=sorted,lambda x:s(x)*(str(s(x))[1:-1]in str(x+x))
print(N([1,2,3,4,5,0]))
</code>```

How it works:

s is a variable storing the sorted python function which sorts lists

N is the main function

The input list sorted: s(x) is multiplied by whether or not the list is driftsortable str(s(x))[1:-1]in str(x+x) (thanks to @xnor)

This works because [1,2,3,4]*false results in an empty list []

and [1,2,3,4]*true results in [1,2,3,4]

Title: Driftsort an array

Body:
Python, 53 bytes

s,N=sorted,lambda x:s(x)*(str(s(x))[1:-1]in str(x+x))

If you want to test this head over to https://www.repl.it/languages/python3 and copy paste this:

s,N=sorted,lambda x:s(x)*(str(s(x))[1:-1]in str(x+x))
print(N([1,2,3,4,5,0]))

How it works:

s is a variable storing the sorted python function which sorts lists

N is the main function

The input list sorted: s(x) is multiplied by whether or not the list is driftsortable str(s(x))[1:-1]in str(x+x) (thanks to @xnor)

This works because [1,2,3,4]*false results in an empty list []

and [1,2,3,4]*true results in [1,2,3,4]


答:
Jelly, 9 bytes

```<code>O%8µ+U5ḍP
</code>```

Try it online! or verify all test cases.

How it works

```<code>O%8µ+U5ḍP  Main link. Argument: S (string)

O          Compute the code points of all characters.
 %8        Compute the residues of division by 8.
           This maps 'ACGT' to [1, 3, 7, 4].
   µ       Begin a new, monadic link. Argument: A (array of residues)
    +U     Add A and A reversed.
      5ḍ   Test the sums for divisibility by 5.
           Of the sums of all pairs of integers in [1, 3, 7, 4], only 1 + 4 = 5
           and 3 + 7 = 10 are divisible by 5, thus identifying the proper pairings.
        P  Take the product of the resulting Booleans.
</code>```

Title: Watson-Crick palindromes

Body:
Problem

Create a function that can determine whether or not an arbitrary DNA string is a Watson-Crick palindrome. The function will take a DNA string and output a true  value if the string is a Watson-Crick palindrome and a false value if it is not. (True and False can also be represented as 1 and 0, respectively.)

The DNA string may either be in all uppercase or all lowercase depending on your preference.

Also, the DNA string will not be empty.

Explanation

A DNA string is a Watson-Crick palindrome when the complement of its reverse is equal to itself.

Given a DNA string, first reverse it, and then complement each character according to the DNA bases (A ↔ T and C ↔ G). If the original string is equal to the complemented-reverse string, it is a Watson-Crick palindrome.

For more, see this question. It is a different challenge where you must find the longest substring of a DNA string where that substring is a Watson-Crick palindrome.

Goal

This is code-golf and the shortest code wins.

Test Cases

The format is <input> = <output>.

```<code>ATCGCGAT = true
AGT = false
GTGACGTCAC = true
GCAGTGA = false
GCGC = true
AACTGCGTTTAC = false
ACTG = false
</code>```

Body:
Jelly, 9 bytes

O%8µ+U5ḍP

Try it online! or verify all test cases.

How it works

O%8µ+U5ḍP  Main link. Argument: S (string)

O          Compute the code points of all characters.
 %8        Compute the residues of division by 8.
           This maps 'ACGT' to [1, 3, 7, 4].
   µ       Begin a new, monadic link. Argument: A (array of residues)
    +U     Add A and A reversed.
      5ḍ   Test the sums for divisibility by 5.
           Of the sums of all pairs of integers in [1, 3, 7, 4], only 1 + 4 = 5
           and 3 + 7 = 10 are divisible by 5, thus identifying the proper pairings.
        P  Take the product of the resulting Booleans.


答:
Python 2, 56 45 44 bytes

```<code>lambda s:s==s[::-1].translate("_T_GA__C"*32)
</code>```

Title: Watson-Crick palindromes

Body:
Python 2, 56 45 44 bytes

lambda s:s==s[::-1].translate("_T_GA__C"*32)


答:
JavaScript (ES6), 59 bytes

```<code>f=s=>!s||/^(A.*T|C.*G|G.*C|T.*A)$/.test(s)&f(s.slice(1,-1))
</code>```

Best I could do without using Regexp was 62 bytes:

```<code>f=s=>!s||parseInt(s[0]+s.slice(-1),33)%32%7<1&f(s.slice(1,-1))
</code>```

Title: Watson-Crick palindromes

Body:
JavaScript (ES6), 59 bytes

f=s=>!s||/^(A.*T|C.*G|G.*C|T.*A)$/.test(s)&f(s.slice(1,-1))

Best I could do without using Regexp was 62 bytes:

f=s=>!s||parseInt(s[0]+s.slice(-1),33)%32%7<1&f(s.slice(1,-1))


答:
Perl, 27 bytes

Includes +2 for -lp

Give input on STDIN, prints 1 or nothing:

```<code>dnapalin.pl <<< ATCGCGAT
</code>```

dnapalin.pl:

```<code>#!/usr/bin/perl -lp
$_=y/ATCG/TAGC/r=~reverse
</code>```

Replace $_= by $_+= to get 0 instead of empty for the false case

Title: Watson-Crick palindromes

Body:
Perl, 27 bytes

Includes +2 for -lp

Give input on STDIN, prints 1 or nothing:

dnapalin.pl <<< ATCGCGAT

dnapalin.pl:

#!/usr/bin/perl -lp
$_=y/ATCG/TAGC/r=~reverse

Replace $_= by $_+= to get 0 instead of empty for the false case


答:
Ruby, 35

I tried other ways, but the obvious way was the shortest:

```<code>->s{s.tr('ACGT','TGCA').reverse==s}
</code>```

in test program

```<code>f=->s{s.tr('ACGT','TGCA').reverse==s}

puts f['ATCGCGAT']
puts f['AGT']
puts f['GTGACGTCAC']
puts f['GCAGTGA']
puts f['GCGC']
puts f['AACTGCGTTTAC']
</code>```

Title: Watson-Crick palindromes

Body:
Ruby, 35

I tried other ways, but the obvious way was the shortest:

->s{s.tr('ACGT','TGCA').reverse==s}

in test program

f=->s{s.tr('ACGT','TGCA').reverse==s}

puts f['ATCGCGAT']
puts f['AGT']
puts f['GTGACGTCAC']
puts f['GCAGTGA']
puts f['GCGC']
puts f['AACTGCGTTTAC']


答:
Jolf, 16 bytes

Try it here!

```<code>pe+i~Aiγ"GATC"_γ
</code>```

Explanation

```<code>pe+i~Aiγ"GATC"_γ
    ~Aiγ"GATC"_γ  perform DNA transformation
  +i              i + (^)
pe                is a palindrome
</code>```

Title: Watson-Crick palindromes

Body:
Jolf, 16 bytes

Try it here!

pe+i~Aiγ"GATC"_γ

Explanation

pe+i~Aiγ"GATC"_γ
    ~Aiγ"GATC"_γ  perform DNA transformation
  +i              i + (^)
pe                is a palindrome


答:
Factor, 72 bytes

Unfortunately regex can't help me here.

```<code>[ dup reverse [ { { 67 71 } { 65 84 } { 71 67 } { 84 65 } } at ] map = ]
</code>```

Reverse, lookup table, compare equal.

Title: Watson-Crick palindromes

Body:
Factor, 72 bytes

Unfortunately regex can't help me here.

[ dup reverse [ { { 67 71 } { 65 84 } { 71 67 } { 84 65 } } at ] map = ]

Reverse, lookup table, compare equal.


Title: Watson-Crick palindromes

Body:
Retina, 52 bytes

^G(.*)C$
$1
^A(.*)T$
$1
^T(.*)A$
$1
}`^C(.*)G$
$1
^$


问:
Fibonacci function or sequence
The Fibonacci sequence is a sequence of numbers, where every number in the sequence is the sum of the two numbers preceding it.  The first two numbers in the sequence are both 1. Here are the first few terms:

```<code>1 1 2 3 5 8 13 21 34 55 89 ...
</code>```

Write the shortest code that either:

Generates the Fibonacci sequence without end.

Given n calculates the nth term of the sequence. (Either 1 or zero indexed)

You may use standard forms of input and output.

(I gave both options in case one is easier to do in your chosen language than the other.)

For the function that takes an n, a reasonably large return value (the largest Fibonacci number that fits your computer's normal word size, at a minimum) has to be supported.

Leaderboard

/* Configuration */

var QUESTION_ID = 85; // 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 = 3; // 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: 290px;
  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

```

Title: Fibonacci function or sequence

Body:
Python 2, 43 bytes

def f(n):k=9**n;return k**-~-~n/~-(k*~-k)%k


答:
Julia, <s>47</s> 38 bytes

s->((x=map(Int,s)%8)+reverse(x))%5⊆0
```

This is an anonymous function that accepts a Char array and returns a boolean. To call it, assign it to a variable.

This uses Dennis' algorithm, which is shorter than the naïve solution. We get the remainder of each code point divided by 8, add that to itself reversed, get the remainders from division by 5, and check whether all are 0. The last step is accomplished using ⊆, the infix version of issubset, which casts both arguments to Set before checking. This means that [0,0,0] is declared a subset of 0, since Set([0,0,0]) == Set(0). This is shorter than an explicit check against 0.

Try it online!

Saved 9 bytes thanks to Dennis!

Title: Watson-Crick palindromes

Body:
Julia, <s>47</s> 38 bytes

s->((x=map(Int,s)%8)+reverse(x))%5⊆0

This is an anonymous function that accepts a Char array and returns a boolean. To call it, assign it to a variable.

This uses Dennis' algorithm, which is shorter than the naïve solution. We get the remainder of each code point divided by 8, add that to itself reversed, get the remainders from division by 5, and check whether all are 0. The last step is accomplished using ⊆, the infix version of issubset, which casts both arguments to Set before checking. This means that [0,0,0] is declared a subset of 0, since Set([0,0,0]) == Set(0). This is shorter than an explicit check against 0.

Try it online!

Saved 9 bytes thanks to Dennis!


答:
Ruby, <s>75</s> 74 bytes

Kinda wish that Ruby's Math module had a factorial function so I didn't have to build my own.

```<code>->l{f=->x{x<2?1:x*f[x-1]};l.uniq.map{|e|f[l.count e]}.inject f[l.size],:/}
</code>```

Title: Permutations with Indistinguishable Items

Body:
Given a list of integers, output the number of permutations of the integers, with indistinguishable permutations counted once. If there are n integers, and each group of indistinguishable numbers has length n_i, this is n! / (n_1! * n_2! * ...)

Rules

Input will be some form of list as arguments to a function or the program with 1 to 12 non-negative integers.

Output will be printing or returning the number of permutations as described above.

No standard loopholes or built-in functions (generating permutations, combinations, etc.). Factorials are allowed.

Test Cases

Inputs:

```<code>1, 3000, 2, 2, 8
1, 1, 1
2, 4, 3, 2, 3, 4, 4, 4, 4, 4, 1, 1
</code>```

Outputs:

```<code>60
1
83160
</code>```

Body:
Ruby, <s>75</s> 74 bytes

Kinda wish that Ruby's Math module had a factorial function so I didn't have to build my own.

->l{f=->x{x<2?1:x*f[x-1]};l.uniq.map{|e|f[l.count e]}.inject f[l.size],:/}


答:
Actually, 19 bytes

```<code>O`8@%`M;RZ`5@Σ%Y`Mπ
</code>```

This uses Dennis's algorithm.

Try it online!

Explanation:

```<code>O`8@%`M;RZ`5@Σ%Y`Mπ
O                    push an array containing the Unicode code points of the input
 `8@%`M              modulo each code point by 8
       ;RZ           zip with reverse
          `5@Σ%Y`M   test sum for divisibility by 5
                  π  product
</code>```

Title: Watson-Crick palindromes

Body:
Actually, 19 bytes

O`8@%`M;RZ`5@Σ%Y`Mπ

This uses Dennis's algorithm.

Try it online!

Explanation:

O`8@%`M;RZ`5@Σ%Y`Mπ
O                    push an array containing the Unicode code points of the input
 `8@%`M              modulo each code point by 8
       ;RZ           zip with reverse
          `5@Σ%Y`M   test sum for divisibility by 5
                  π  product


问:
The Arithmetic Derivative
The derivative of a function is a cornerstone of mathematics, engineering, physics, biology, chemistry, and a large number of other sciences as well. Today we're going to be calculating something only tangentially related: the arithmetic derivative.

Definition

The arithmetic derivative a(n) or n' is defined here (A003415) by a number of properties that are similar to the derivative of a function.

a(0) = a(1) = 0,

a(p) = 1, where p is any prime, and

a(mn) = m*a(n) + n*a(m).

The third rule is based on the product rule for differentiation of functions: for functions f(x) and g(x), (fg)' = f'g + fg'. So with numbers, (ab)' = a'b + ab'.

Also of note, since the arithmetic derivative can be extended to the negative numbers via this simple relation, a(-n) = -a(n), the input may be negative.

Rules

Write a program or function that, given any integer n, returns the arithmetic derivative of n.

Inputs will be -230 < n < 230, to avoid problems with integer sizes and numbers too large to factor in a reasonable amount of time. Your algorithm should still be able to theoretically calculate the arithmetic derivative of numbers outside this range.

Built-ins for symbolic math, prime factorization and differentiation are allowed.

Examples

```<code>> a(1)
0
> a(7)
1
> a(14)   # a(7)*2 + a(2)*7 = 1*2 + 1*7 = 9
9
> a(-5)   # a(-5) = -a(5) = -1
-1
> a(8)    # a(8) = a(2**3) = 3*2**2 = 12
12
> a(225)  # a(225) = a(9)*25 + a(25)*9 = 6*25 + 10*9 = 150 + 90 = 240
240
> a(299792458)  # a(299792458) = a(2)*149896229 + a(7)*42827494 + a(73)*4106746 + a(293339)*1022 = 1*149896229 + 1*42827494 + 1*4106746 + 1*1022 = 149896229 + 42827494 + 4106746 + 1022 = 196831491
196831491
</code>```

As always, if the problem is unclear, please let me know. Good luck and good golfing!

答:
Perl 5, 62 bytes

```<code>perl -MMath::Prime::Util=:all -E"map$i+=1/$_,factor abs($j=<>);say$i*$j"
</code>```

Uses the formula (from OEIS): If n = Product p_i^e_i, a(n) = n * Sum (e_i/p_i).

Title: The Arithmetic Derivative

Body:
Perl 5, 62 bytes

perl -MMath::Prime::Util=:all -E"map$i+=1/$_,factor abs($j=<>);say$i*$j"

Uses the formula (from OEIS): If n = Product p_i^e_i, a(n) = n * Sum (e_i/p_i).


答:
C,71

```<code>r,e;f(char*s){for(r=0,e=strlen(s)+1;*s;s++)r|=*s*s[e-=2]%5^2;return!r;}
</code>```

2 bytes saved by Dennis. Additional 2 bytes saved by adapting for lowercase input: constants 37 and 21 are revised to 5 and 2.

C,75

```<code>i,j;f(char*s){for(i=j=0;s[i];i++)j|=s[i]*s[strlen(s)-i-1]%37!=21;return!j;}
</code>```

Saved one byte: Eliminated parenthesis by taking the product of the two ASCII codes mod 37. The valid pairs evaluate to 21. Assumes uppercase input.

C,76

```<code>i,j;f(char*s){for(i=j=0;s[i];i++)j|=(s[i]+s[strlen(s)-i-1])%11!=6;return!j;}
</code>```

Uses the fact that ASCII codes of the valid pairs sum to 138 or 149. When taken mod 11, these are the only pairs that sum to 6. Assumes uppercase input.

ungolfed in test program

```<code>i,j;

f(char *s){
   for(i=j=0;s[i];i++)                  //initialize i and j to 0; iterate i through the string
     j|=(s[i]+s[strlen(s)-i-1])%11!=6;  //add characters at i from each end of string, take result mod 11. If not 6, set j to 1
return!j;}                              //return not j (true if mismatch NOT detected.)

main(){
  printf("%d\n", f("ATCGCGAT"));
  printf("%d\n", f("AGT"));
  printf("%d\n", f("GTGACGTCAC"));
  printf("%d\n", f("GCAGTGA"));
  printf("%d\n", f("GCGC"));
  printf("%d\n", f("AACTGCGTTTAC"));
}
</code>```

Title: Watson-Crick palindromes

Body:
C,71

r,e;f(char*s){for(r=0,e=strlen(s)+1;*s;s++)r|=*s*s[e-=2]%5^2;return!r;}

2 bytes saved by Dennis. Additional 2 bytes saved by adapting for lowercase input: constants 37 and 21 are revised to 5 and 2.

C,75

i,j;f(char*s){for(i=j=0;s[i];i++)j|=s[i]*s[strlen(s)-i-1]%37!=21;return!j;}

Saved one byte: Eliminated parenthesis by taking the product of the two ASCII codes mod 37. The valid pairs evaluate to 21. Assumes uppercase input.

C,76

i,j;f(char*s){for(i=j=0;s[i];i++)j|=(s[i]+s[strlen(s)-i-1])%11!=6;return!j;}

Uses the fact that ASCII codes of the valid pairs sum to 138 or 149. When taken mod 11, these are the only pairs that sum to 6. Assumes uppercase input.

ungolfed in test program

i,j;

f(char *s){
   for(i=j=0;s[i];i++)                  //initialize i and j to 0; iterate i through the string
     j|=(s[i]+s[strlen(s)-i-1])%11!=6;  //add characters at i from each end of string, take result mod 11. If not 6, set j to 1
return!j;}                              //return not j (true if mismatch NOT detected.)

main(){
  printf("%d\n", f("ATCGCGAT"));
  printf("%d\n", f("AGT"));
  printf("%d\n", f("GTGACGTCAC"));
  printf("%d\n", f("GCAGTGA"));
  printf("%d\n", f("GCGC"));
  printf("%d\n", f("AACTGCGTTTAC"));
}


答:
Retina, <s>34</s> 33 bytes

```<code>$
;$_
T`ACGT`Ro`;.+
+`(.);\1
;
^;
</code>```

Try it online! (Slightly modified to run all test cases at once.)

Explanation

```<code>$
;$_
</code>```

Duplicate the input by matching the end of the string and inserting a ; followed by the entire input.

```<code>T`ACGT`Ro`;.+
</code>```

Match only the second half of the input with ;.+ and perform the substitution of pairs with a transliteration. As for the target set Ro: o references the other set, that is o is replaced with ACGT. But R reverses this set, so the two sets are actually:

```<code>ACGT
TGCA
</code>```

If the input is a DNA palindrome, we will now have the input followed by its reverse (separated by ;).

```<code>+`(.);\1
;
</code>```

Repeatedly (+) remove a pair of identical characters around the ;. This will either continue until only the ; is left or until the two characters around the ; are no longer identical, which would mean that the strings aren't the reverse of each other.

```<code>^;
</code>```

Check whether the first character is ; and print 0 or 1 accordingly.

Title: Watson-Crick palindromes

Body:
Retina, <s>34</s> 33 bytes

$
;$_
T`ACGT`Ro`;.+
+`(.);\1
;
^;

Try it online! (Slightly modified to run all test cases at once.)

Explanation

$
;$_

Duplicate the input by matching the end of the string and inserting a ; followed by the entire input.

T`ACGT`Ro`;.+

Match only the second half of the input with ;.+ and perform the substitution of pairs with a transliteration. As for the target set Ro: o references the other set, that is o is replaced with ACGT. But R reverses this set, so the two sets are actually:

ACGT
TGCA

If the input is a DNA palindrome, we will now have the input followed by its reverse (separated by ;).

+`(.);\1
;

Repeatedly (+) remove a pair of identical characters around the ;. This will either continue until only the ; is left or until the two characters around the ; are no longer identical, which would mean that the strings aren't the reverse of each other.

^;

Check whether the first character is ; and print 0 or 1 accordingly.


答:
Oracle SQL 11.2, 68 bytes

SELECT DECODE(TRANSLATE(REVERSE(:1),'ATCG','TAGC'),:1,1,0)FROM DUAL;
```

Title: Watson-Crick palindromes

Body:
Problem

Create a function that can determine whether or not an arbitrary DNA string is a Watson-Crick palindrome. The function will take a DNA string and output a true  value if the string is a Watson-Crick palindrome and a false value if it is not. (True and False can also be represented as 1 and 0, respectively.)

The DNA string may either be in all uppercase or all lowercase depending on your preference.

Also, the DNA string will not be empty.

Explanation

A DNA string is a Watson-Crick palindrome when the complement of its reverse is equal to itself.

Given a DNA string, first reverse it, and then complement each character according to the DNA bases (A ↔ T and C ↔ G). If the original string is equal to the complemented-reverse string, it is a Watson-Crick palindrome.

For more, see this question. It is a different challenge where you must find the longest substring of a DNA string where that substring is a Watson-Crick palindrome.

Goal

This is code-golf and the shortest code wins.

Test Cases

The format is <input> = <output>.

```<code>ATCGCGAT = true
AGT = false
GTGACGTCAC = true
GCAGTGA = false
GCGC = true
AACTGCGTTTAC = false
ACTG = false
</code>```


问:
Create a Boolean parser (continued)
Continuation of this challenge because the author is gone and the question is closed.

What you need to do is create a Boolean parser.

Boolean expressions, in case you haven't heard of them yet, have two inputs and one output.

There are four "gates" in boolean arithmetic, namely:

OR (represented by |) (binary operator, between arguments)

AND (represented by &) (binary operator, between arguments)

XOR (represented by ^) (binary operator, between arguments)

NOT (represented by !) (unary operator, argument on right)

These gates operate on their inputs which are either true (represented by 1) or false (represented by 0). We can list the possible inputs (A and B in this case) and the outputs (O) using a truth table as follows:

```<code>XOR
A|B|O
-----
0|0|0
0|1|1
1|0|1
1|1|0

OR
A|B|O
-----
0|0|0
0|1|1
1|0|1
1|1|1

AND
A|B|O
-----
0|0|0
0|1|0
1|0|0
1|1|1

NOT
A|O
---
0|1
1|0
</code>```

An example input would be 1^((1|0&0)^!(1&!0&1)), which would evaluate to:

```<code> 1^((1|0&0)^!(1&!0&1))
=1^(( 1 &0)^!(1&!0&1))
=1^(   0   ^!(1&!0&1))
=1^(   0   ^!(1& 1&1))
=1^(   0   ^!(  1 &1))
=1^(   0   ^!    1   )
=1^(   0   ^    0    )
=1^0
=1
</code>```

The output would be 1.

Details

As seen in the example, there is no order of prevalence. All are evaluated from left to right, except when inside parentheses, which should be evaluated first.

The input will only contain ()!^&|01.

You can choose any 8-byte character to replace the 8 characters above, but they must have a 1-to-1 mapping and must be stated.

Specifically, the function eval is not allowed to be used on any string derived from the input. Specifically, the function input (or the equivalent in the language) and any function that calls it cannot be used by eval. You also cannot concatenate the input into your string inside the eval.

Scoring

This is code-golf. Shortest solution in bytes wins.

答:
Retina, 49 bytes

```<code>+`(<1>|!0|1[ox]0|0[ox]1|1[ao]1)|<0>|!1|\d\w\d
$#1
</code>```

I have no idea how did it come out so short.

Character mapping:

```<code>^ -> x
& -> a
| -> o
( -> <
) -> >
</code>```

1, 0, and ! are left unchanged.

This works by replacing all truthy expressions (single 1 in parentheses, !0, 1&1, 1^0, 0|1, etc.) with 1, and all other (single 0 in parentheses, !1, 1&0, 1^1, 0|0, etc.) with 0.

Try it online!

Try it online with automatic character mapping!

Title: Create a Boolean parser (continued)

Body:
Retina, 49 bytes

+`(<1>|!0|1[ox]0|0[ox]1|1[ao]1)|<0>|!1|\d\w\d
$#1

I have no idea how did it come out so short.

Character mapping:

^ -> x
& -> a
| -> o
( -> <
) -> >

1, 0, and ! are left unchanged.

This works by replacing all truthy expressions (single 1 in parentheses, !0, 1&1, 1^0, 0|1, etc.) with 1, and all other (single 0 in parentheses, !1, 1&0, 1^1, 0|0, etc.) with 0.

Try it online!

Try it online with automatic character mapping!


问:
One-zero dividend

Challenge description

For every positive integer n there exists a number having the form of 111...10...000 that is divisible by n i.e. a decimal number that starts with all 1's and ends with all 0's. This is very easy to prove: if we take a set of n+1 different numbers in the form of 111...111 (all 1's), then at least two of them will give the same remainder after division by n (as per pigeonhole principle). The difference of these two numbers will be divisible by n and will have the desired form. Your aim is to write a program that finds this number.

Input description

A positive integer.

Output description

A number p in the form of 111...10...000, such that p ≡ 0 (mod n). If you find more than one - display any of them (doesn't need to be the smallest one).

Notes

Your program has to give the answer in a reasonable amount of time. Which means brute-forcing is not permited:

```<code>p = 0
while (p != 11..10.00 and p % n != 0)
    p++
</code>```

Neither is this:

```<code>do
    p = random_int()
while (p != 11..10.00 and p % n != 0)
</code>```

Iterating through the numbers in the form of 11..10..00 is allowed.

Your program doesn't need to handle an arbitrarily large input - the upper bound is whatever your language's upper bound is.

Sample outputs

```<code>2: 10
3: 1110
12: 11100
49: 1111111111111111111111111111111111111111110
102: 1111111111111111111111111111111111111111111111110
</code>```

答:
Sage, 33 bytes

lambda n:'1'*9*euler_phi(n)+'0'*n
```

This uses xnor's method to produce the output.

Try it online

Title: One-zero dividend

Body:
Sage, 33 bytes

lambda n:'1'*9*euler_phi(n)+'0'*n

This uses xnor's method to produce the output.

Try it online


问:
Distance between two points in n-dimensional space
Here is another simple one:

The Challenge

Given two points in an n-dimensional space, output the distance between them, also called the Euclidean distance.

The coordinates will be rational numbers; the only limits are the restrictions of your language.

Lowest dimension is 1, highest is whatever your language can handle

You may assume that the two points are of the same dimension and that there will be no empty input.

The distance has to be correct to at least 3 decimal places. If your language does not support floating point numbers, output the nearest whole number.

Rules

As usual, function or full program allowed.

Input may be taken from STDIN, command line- or function arguments.

Input format is up to you, specify which one you used in your answer.

Output may be provided by printing to stdout or return value.

This is code-golf so lowest byte-count wins! In case of a tie, the earlier answer wins.

Test cases

Each point is represented by a list of length n.

```<code>[1], [3] -> 2
[1,1], [1,1] -> 0
[1,2], [3,4] -> 2.82842712475
[1,2,3,4], [5,6,7,8] -> 8
[1.5,2,-5], [-3.45,-13,145] -> 150.829382085
[13.37,2,6,-7], [1.2,3.4,-5.6,7.89] -> 22.5020221314
</code>```

Happy Coding!

答:
Sage, 35 bytes

lambda a,b,v=vector:norm(v(a)-v(b))
```

This function takes 2 lists as input and returns a symbolic expression. The distance is calculated by performing vector subtraction on the lists and computing the Euclidean norm of the resultant vector.

Try it online

Body:
Sage, 35 bytes

lambda a,b,v=vector:norm(v(a)-v(b))

This function takes 2 lists as input and returns a symbolic expression. The distance is calculated by performing vector subtraction on the lists and computing the Euclidean norm of the resultant vector.

Try it online


问:
Convert a Forsyth-Edwards Notation string to ASCII art
In chess, Forsyth-Edwards Notation, more commonly called "FEN", is a textual way of transcribing boards. It describes each of the board's eight rows (called "ranks" in chess) from top to bottom from White's perspective. The pieces are written as K (king), Q (queen), R (rook), B (bishop), N (knight), and P (pawn). Black pieces use these letters in lowercase, and white pieces use these letters in uppercase. Empty spaces are indicated by a number from 1 to 8 indicating how many consecutive empty spaces there are. A completely empty rank would be 8, a single black rook in the rightmost column (called "files" in chess) would be 7r, and two white pawns on each end of a row would be PP4PP. Ranks are separated by a /. There is normally other information added, indicating which side is to move, castling and en passant rights, move number, and halfmove clock, but we will ignore them for the purposes of this challenge.

Input

A FEN string, from the command line or STDIN, as you please. You may assume that this string is always valid.

Output

Write to STDOUT a simple ASCII art representation of the board as it would actually appear:

Pieces are represented by their character in FEN

Empty squares are represented by spaces

Pieces and squares are separated by a pipe | and there are pipes on each side of the board

So an empty board, written as 8/8/8/8/8/8/8/8 in FEN, would appear as

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

The starting position of a chess game is written as rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR, and would appear as

```<code>|r|n|b|q|k|b|n|r|
|p|p|p|p|p|p|p|p|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
|P|P|P|P|P|P|P|P|
|R|N|B|Q|K|B|N|R|
</code>```

The final position of Anderssen-Kieseritzky 1851, called "The Immortal Game" in the chess community, is written as r1bk3r/p2pBpNp/n4n2/1p1NP2P/6P1/3P4/P1P1K3/q5b1, and your program when fed that input would output:

```<code>|r| |b|k| | | |r|
|p| | |p|B|p|N|p|
|n| | | | |n| | |
| |p| |N|P| | |P|
| | | | | | |P| |
| | | |P| | | | |
|P| |P| |K| | | |
|q| | | | | |b| |
</code>```

答:
Lua, 106 Bytes

print("|"..(...):gsub(".",function(c)return c:find("%d")and(" |"):rep(c)or c=="/"and"\n|"or c.."|"end),'')
```

<h3>Ungolfed</h3>

<pre class="lang-lua prettyprint-override"><code>print("|"..                   -- prepend | to the following string
  (...):gsub(".",function(c)  -- iterate over each character in the argument
    return                    -- replaces in the argument
           c:find("%d")       -- if c is a number
             and(" |"):rep(c) --   replace by " |"*c
           or c=="/"          -- elseif c is a slash
             and"\n|"         -- replace by "\n|"
           or c.."|"          -- else (case letter)replace by c
  end)                        -- return the modified string
,'')                          -- add an empty parameter to print
                              -- it suppresses the second output of gsub
</code>```

Body:
Lua, 106 Bytes

print("|"..(...):gsub(".",function(c)return c:find("%d")and(" |"):rep(c)or c=="/"and"\n|"or c.."|"end),'')

Ungolfed

print("|"..                   -- prepend | to the following string
  (...):gsub(".",function(c)  -- iterate over each character in the argument
    return                    -- replaces in the argument
           c:find("%d")       -- if c is a number
             and(" |"):rep(c) --   replace by " |"*c
           or c=="/"          -- elseif c is a slash
             and"\n|"         -- replace by "\n|"
           or c.."|"          -- else (case letter)replace by c
  end)                        -- return the modified string
,'')                          -- add an empty parameter to print
                              -- it suppresses the second output of gsub


答:
CJam, 17 bytes

```<code>q~_,\$e`0f=+:m!:/
</code>```

Test it here.

Explanation

```<code>q~   e# Read input and evaluate.
_,   e# Duplicate and get length.
\$   e# Swap with other copy and sort it.
e`   e# Run-length encode. Since the list is sorted, this tallies the numbers.
0f=  e# Select the tally of each number.
+    e# Prepend the length of the input.
:m!  e# Compute the factorial of each number in the list.
:/   e# Fold division over it, which divides each factorial of a tally into
     e# the factorial of the length.
</code>```

Body:
CJam, 17 bytes

q~_,\$e`0f=+:m!:/

Test it here.

Explanation

q~   e# Read input and evaluate.
_,   e# Duplicate and get length.
\$   e# Swap with other copy and sort it.
e`   e# Run-length encode. Since the list is sorted, this tallies the numbers.
0f=  e# Select the tally of each number.
+    e# Prepend the length of the input.
:m!  e# Compute the factorial of each number in the list.
:/   e# Fold division over it, which divides each factorial of a tally into
     e# the factorial of the length.


问:
Co-primality and the number pi

Introduction

Number theory is full of wonders, in the form of unexpected connections. Here's one of them.

Two integers are co-prime if they have no factors in common other than 1. Given a number \$N\$, consider all integers from 1 to \$N\$. Draw two such integers at random (all integers have the same probability of being selected at each draw; draws are independent and with replacement). Let \$p\$ denote the probability that the two selected integers are co-prime. Then \$p\$ tends to \${6} / {\pi^2} \approx 0.6079...\$ as \$N\$ tends to infinity.

The challenge

The purpose of this challenge is to compute \$p\$ as a function of \$N\$.

As an example, consider \$N = 4\$. There are 16 possible pairs obtained from the integers 1,2,3,4. 11 of those pairs are co-prime, namely \$(1,1)\$, \$(1,2)\$, \$(1,3)\$, \$(1,4)\$, \$(2,1)\$, \$(3,1)\$, \$(4,1)\$, \$(2,3)\$, \$(3,2)\$, \$(3,4)\$, \$(4,3)\$. Thus \$p = {11} / {16} = 0.6875\$ for \$N = 4\$.

The exact value of \$p\$ needs to be computed with at least \$4\$ decimals. This implies that the computation has to be deterministic (as opposed to Monte Carlo). But it need not be a direct enumeration of all pairs as above; any method can be used.

Function arguments or stdin/stdout may be used. If displaying the output, trailing zeros may be omitted. So for example \$0.6300\$ can be displayed as 0.63. It should be displayed as a decimal number, not as a fraction (displaying the string 63/100 is not allowed).

Winning criterion is fewest bytes. There are no restrictions on the use of built-in functions.

Test cases

Input / output (only four decimals are mandatory, as indicated above):

```<code>1    / 1.000000000000000
2    / 0.750000000000000
4    / 0.687500000000000
10   / 0.630000000000000
100  / 0.608700000000000
1000 / 0.608383000000000
</code>```

答:
Sage, 55 bytes

lambda a:n((sum(map(euler_phi,range(1,a+1)))*2-1)/a**2)
```

Thanks to Sage computing everything symbolically, machine epsilon and floating-point issues don't crop up. The tradeoff is, in order to follow the output format rule, an additional call to n() (the decimal approximation function) is needed.

Try it online

Title: Co-primality and the number pi

Body:
Sage, 55 bytes

lambda a:n((sum(map(euler_phi,range(1,a+1)))*2-1)/a**2)

Thanks to Sage computing everything symbolically, machine epsilon and floating-point issues don't crop up. The tradeoff is, in order to follow the output format rule, an additional call to n() (the decimal approximation function) is needed.

Try it online


答:
05AB1E, <s>10</s> 7 bytes

Code:

```<code>Â'š×Â‡Q
</code>```

Explanation:

To check if a string is a palindrome, we just need to check the input with the input, with at swapped and cg swapped and then reverse it. So that is what we are going to do. We push the input and the input reversed using Â (bifurcate). Now comes a tricky part. 'š× is the compressed version for creating. If we reverse it, you can see why it's in the code:

```<code>CreATinG
|  ||  |
GniTAerC
</code>```

This will be used to transliterate the reversed input. Transliteration is done with ‡. After that, we just check if the input and the transliterated input are eQual and print that value. So this is how the stack looks like for input actg :

```<code>Â          # ["actg", "gtca"]
 'š×       # ["actg", "gtca", "creating"]
    Â      # ["actg", "gtca", "creating", "gnitaerc"]
     ‡     # ["actg", "cagt"]
      Q    # [0]
</code>```

Which can also be seen with the debug flag (Try it here).

Uses CP-1252 encoding. Try it online!.

Title: Watson-Crick palindromes

Body:
05AB1E, <s>10</s> 7 bytes

Code:

Â'š×Â‡Q

Explanation:

To check if a string is a palindrome, we just need to check the input with the input, with at swapped and cg swapped and then reverse it. So that is what we are going to do. We push the input and the input reversed using Â (bifurcate). Now comes a tricky part. 'š× is the compressed version for creating. If we reverse it, you can see why it's in the code:

CreATinG
|  ||  |
GniTAerC

This will be used to transliterate the reversed input. Transliteration is done with ‡. After that, we just check if the input and the transliterated input are eQual and print that value. So this is how the stack looks like for input actg :

Â          # ["actg", "gtca"]
 'š×       # ["actg", "gtca", "creating"]
    Â      # ["actg", "gtca", "creating", "gnitaerc"]
     ‡     # ["actg", "cagt"]
      Q    # [0]

Which can also be seen with the debug flag (Try it here).

Uses CP-1252 encoding. Try it online!.


答:
J, 13  bytes

```<code>#(%*/)&:!#/.~
</code>```

Usage

```<code>   f =: #(%*/)&:!#/.~
   f 1 3000 2 2 8
60
   f 1 1 1
1
   f 2 4 3 2 3 4 4 4 4 4 1 1
83160
</code>```

Explanation

```<code>#(%*/)&:!#/.~  Input: A
         #/.~  Partition A by equal values and get the size of each, these are the tallies
#              Get the size of A
      &:!      Take the factorial of both the size and the tallies
   */          Reduce using multiplication the factorial of the tallies
  %            Divide the factorial of the size by that product and return
</code>```

Body:
J, 13  bytes

#(%*/)&:!#/.~

Usage

   f =: #(%*/)&:!#/.~
   f 1 3000 2 2 8
60
   f 1 1 1
1
   f 2 4 3 2 3 4 4 4 4 4 1 1
83160

Explanation

#(%*/)&:!#/.~  Input: A
         #/.~  Partition A by equal values and get the size of each, these are the tallies
#              Get the size of A
      &:!      Take the factorial of both the size and the tallies
   */          Reduce using multiplication the factorial of the tallies
  %            Divide the factorial of the size by that product and return


答:
J - 21 bytes

```<code>0=[:+/5|[:(+|.)8|3&u:
</code>```

Based on Dennis' method

Usage

```<code>   f =: 0=[:+/5|[:(+|.)8|3&u:
   f 'ATCGCGAT'
1
   f 'AGT'
0
   f 'GTGACGTCAC'
1
   f 'GCAGTGA'
0
   f 'GCGC'
1
   f 'AACTGCGTTTAC'
0
   f 'ACTG'
0
</code>```

Explanation

```<code>0=[:+/5|[:(+|.)8|3&u:
                 3&u:    - Convert from char to int
               8|        - Residues from division by 8 for each
            |.           - Reverse the list
           +             - Add from the list and its reverse element-wise
        [:               - Cap, compose function
      5|                 - Residues from division by 5 for each
    +/                   - Fold right using addition to create a sum
  [:                     - Cap, compose function
0=                       - Test the sum for equality to zero
</code>```

Title: Watson-Crick palindromes

Body:
J - 21 bytes

0=[:+/5|[:(+|.)8|3&u:

Based on Dennis' method

Usage

   f =: 0=[:+/5|[:(+|.)8|3&u:
   f 'ATCGCGAT'
1
   f 'AGT'
0
   f 'GTGACGTCAC'
1
   f 'GCAGTGA'
0
   f 'GCGC'
1
   f 'AACTGCGTTTAC'
0
   f 'ACTG'
0

Explanation

0=[:+/5|[:(+|.)8|3&u:
                 3&u:    - Convert from char to int
               8|        - Residues from division by 8 for each
            |.           - Reverse the list
           +             - Add from the list and its reverse element-wise
        [:               - Cap, compose function
      5|                 - Residues from division by 5 for each
    +/                   - Fold right using addition to create a sum
  [:                     - Cap, compose function
0=                       - Test the sum for equality to zero


答:
Bash + coreutils, <s>43</s> 32 bytes

[ `tr ATCG TAGC<<<$1|rev` = $1 ]
```

<h3>Tests:</h3>

<pre class="lang-sh prettyprint-override"><code>for i in ATCGCGAT AGT GTGACGTCAC GCAGTGA GCGC AACTGCGTTTAC; do ./78410.sh $i && echo $i = true || echo $i = false; done
ATCGCGAT = true
AGT = false
GTGACGTCAC = true
GCAGTGA = false
GCGC = true
AACTGCGTTTAC = false
</code>```

Title: Watson-Crick palindromes

Body:
Bash + coreutils, <s>43</s> 32 bytes

[ `tr ATCG TAGC<<<$1|rev` = $1 ]

Tests:

for i in ATCGCGAT AGT GTGACGTCAC GCAGTGA GCGC AACTGCGTTTAC; do ./78410.sh $i && echo $i = true || echo $i = false; done
ATCGCGAT = true
AGT = false
GTGACGTCAC = true
GCAGTGA = false
GCGC = true
AACTGCGTTTAC = false


Body:
Given a list of integers, output the number of permutations of the integers, with indistinguishable permutations counted once. If there are n integers, and each group of indistinguishable numbers has length n_i, this is n! / (n_1! * n_2! * ...)

Rules

Input will be some form of list as arguments to a function or the program with 1 to 12 non-negative integers.

Output will be printing or returning the number of permutations as described above.

No standard loopholes or built-in functions (generating permutations, combinations, etc.). Factorials are allowed.

Test Cases

Inputs:

```<code>1, 3000, 2, 2, 8
1, 1, 1
2, 4, 3, 2, 3, 4, 4, 4, 4, 4, 1, 1
</code>```

Outputs:

```<code>60
1
83160
</code>```

Body:
Jelly, 8 bytes

W;ĠL€!:/

Try it online!

W;ĠL€!:/ example input:             [1, 3000, 2, 2, 8]
W        wrap:                      [[1, 3000, 2, 2, 8]]
  Ġ      group index by appearance: [[1], [3, 4], [5], [2]]
 ;       concatenate:               [[1, 3000, 2, 2, 8], [1], [3, 4], [5], [2]]
   L€    map by length:             [5, 1, 2, 1, 1]
     !   [map by] factorial:        [120, 1, 2, 1, 1]
      :/ reduce by division:        120÷1÷2÷1÷1 = 60


问:
Compute the multinomial coefficient
Time for another easy challenge in which all can participate!

The multinomial theorem states:

$$(x_1 + x_2 + \cdots + x_m)^n = \sum_{k_1 + k_2 + \cdots + k_m = n} \binom n {k_1, k_2, \dots, k_m} \prod_{1 \le t \le m} x_t^{k_t}.$$

The expression in parentheses is the multinomial coefficient, defined as:

$$\binom n {k_1, k_2, \dots, k_m} = \frac {n!} {k_1!k_2!\cdots k_m!}$$

Allowing the terms \$k_i\$ to range over all integer partitions of \$n\$ gives the \$n\$-th level of Pascal's \$m\$-simplex. Your task is to compute this coefficient.

Task

Write a program or function which takes \$m\$ numbers, \$n, k_{1}, k_{2}, \dots, k_{m-1}\$, and outputs or returns the corresponding multinomial coefficient. Your program may optionally take \$m\$ as an additional argument if need be. Note that \$k_m\$ is not in the input.

These numbers may be input in any format one likes, for instance grouped into lists or encoded in unary, or anything else, as long as the actual computation of the multinomial coefficient is performed by your code, and not the encoding process.

Output format is similarly flexible.

All code should run in less than one minute for \$n\$ and \$m\$ up to 1000.

Do not worry about integer overflow.

Built-ins designed to compute the multinomial coefficient are not allowed.

Standard loopholes apply.

Scoring

This is code golf: Shortest solution in bytes wins.

Test cases

```<code>Input: 3, [2, 0]
Output: 3

Input: 3, [1, 1]
Output: 6

Input: 11, [1, 4, 4]
Output: 34650

Input: 4, [1,2]
Output: 12

Input: 15, [5,4,3,2]
Output: 37837800

Input: 95, [65,4,4]
Output: 1934550571913396675776550070308250

Input: 32, [2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]
Output: 4015057936610313875842560000000

Input: 15, [3,3,3,3]
Output: 168168000

Input: 1000, [10,10,10,10,10,10,10,10,10,10,100,100,100,100,100,100,100,100]
Output: 1892260836114766064839886173072628322819837473493540916521650371620708316292211493005889278395285403318471457333959691477413845818795311980925098433545057962732816261282589926581281484274178579110373517415585990780259179555579119249444675675971136703240347768185200859583936041679096016595989605569764359198616300820217344233610087468418992008471158382363562679752612394898708988062100932765563185864346460326847538659268068471585720069159997090290904151003744735224635733011050421493330583941651019570222984959183118891461330718594645532241449810403071583062752945668937388999711726969103987467123014208575736645381474142475995771446030088717454857668814925642941036383273459178373839445456712918381796599882439216894107889251444932486362309407245949950539480089149687317762667940531452670088934094510294534762190299611806466111882595667632800995865129329156425174586491525505695534290243513946995156554997365435062121633281021210807821617604582625046557789259061566742237246102255343862644466345335421894369143319723958653232683916869615649006682399919540931573841920000000000000

Input: 33, [17]
Output: 1166803110

Input: 55, [28]
Output: 3824345300380220
</code>```

答:
J, 16 bytes

```<code>[(%*/)&:!],(-+/)
</code>```

Usage

For larger values, a suffix of x is used to denote extended precision integers.

```<code>   f =: [(%*/)&:!],(-+/)
   11 f 1 4 4
34650
   15x f 5 4 3 2
37837800
</code>```

Explanation

```<code>[(%*/)&:!],(-+/)  Input: n on LHS, A on RHS
             +/   Reduce A using addition
            -     Subtract that sum from n, this is the missing term
         ]        Get A
          ,       Append the missing term to A to make A'
[                 Get n
      &:!         Take the factorial of n and each value in A'
   */             Reduce using multiplication the factorials of A'
  %               Divide n! by that product and return
</code>```

Title: Compute the multinomial coefficient

Body:
J, 16 bytes

[(%*/)&:!],(-+/)

Usage

For larger values, a suffix of x is used to denote extended precision integers.

   f =: [(%*/)&:!],(-+/)
   11 f 1 4 4
34650
   15x f 5 4 3 2
37837800

Explanation

[(%*/)&:!],(-+/)  Input: n on LHS, A on RHS
             +/   Reduce A using addition
            -     Subtract that sum from n, this is the missing term
         ]        Get A
          ,       Append the missing term to A to make A'
[                 Get n
      &:!         Take the factorial of n and each value in A'
   */             Reduce using multiplication the factorials of A'
  %               Divide n! by that product and return


答:
Mathcad,  bytes

Uses the built-in vector magnitude (absolute value) operator to calculate the size of the difference between the two points (expressed as vectors).

Mathcad golf size on hold until I get (or somebody else gets) round to opening up the discussion on meta.  However, the shortest way (assuming that input of the point vectors doesn't contribute to the score) is 3 "bytes" , with 14 bytes for the functional version.

Title: Distance between two points in n-dimensional space

Body:
Here is another simple one:

The Challenge

Given two points in an n-dimensional space, output the distance between them, also called the Euclidean distance.

The coordinates will be rational numbers; the only limits are the restrictions of your language.

Lowest dimension is 1, highest is whatever your language can handle

You may assume that the two points are of the same dimension and that there will be no empty input.

The distance has to be correct to at least 3 decimal places. If your language does not support floating point numbers, output the nearest whole number.

Rules

As usual, function or full program allowed.

Input may be taken from STDIN, command line- or function arguments.

Input format is up to you, specify which one you used in your answer.

Output may be provided by printing to stdout or return value.

This is code-golf so lowest byte-count wins! In case of a tie, the earlier answer wins.

Test cases

Each point is represented by a list of length n.

```<code>[1], [3] -> 2
[1,1], [1,1] -> 0
[1,2], [3,4] -> 2.82842712475
[1,2,3,4], [5,6,7,8] -> 8
[1.5,2,-5], [-3.45,-13,145] -> 150.829382085
[13.37,2,6,-7], [1.2,3.4,-5.6,7.89] -> 22.5020221314
</code>```

Happy Coding!


问:
Count up folks!

Introduction

It may sound strange, but we haven't got ONE challenge for counting from 1 to n, inclusive.

This is not the same thing. That one is a (closed) not well-explained challenge.

This is not the same thing. That one is about counting up indefinitely.

Challenge

Write a program or function that prints every integer from 1 to n inclusive.

Rules

You can get n any way.

You can assume that n will always be a positive integer.

You can get n in any base, but you should always output in decimal.

Output must be separated by any character (or pattern) not in 0123456789. Non-decimal leading or trailing characters are allowed (for example when using arrays such as [1, 2, 3, 4, 5, 6]).

Standard loopholes are denied.

We want to find the shortest approach in each language, not the shortest language, so I will not accept any answer.

You must update your answer(s) after this edit, answers posted before the last edit must comply with the change rule about standard loopholes (I didn't want to deny them, but I didn't want to make the community roar, so I denied them).

You can use any post-dating language version (or language). You cannot use any language or language version made just for this challenge.

Bonuses

20%

Your program must be able to count at least up to 18446744073709551615 (2^64-1). For example, if a new datatype is the only way to support big integers, you must construct it. If your language does not have any way to support huge integers up to 2^64-1, the upper limit of that particular language must be supported instead.

EDIT: I've changed the limit from 2^64 to 2^64-1 to allow more answers.

EDIT: I made the 2^64-1 rule a bonus, since there has not been much interest in this challenge. If your answer supports 2^64-1, you can now edit it to include the bonus. Also, you can post an answer not supporting it, if it is shorter.

答:
MarioLANG, 29 bytes

```<code>;
)    <
+===="
>:(-[!
=====#
</code>```

Try it online!

I know my code is sadly super-sad or angry:

```

>:(

```

Happy MarioLANG, 46 bytes

```<code>;
)       <
+======="
>  >((-[!
=:)^====#
 ===
</code>```

Try it online!

A happier approach:

```

 :)

```

Non-emotional MarioLANG, 41 bytes

```<code>;
)     <
+====="
> >(-[!
= "===#
 :!
 =#
</code>```

Try it online!

Title: Count up folks!

Body:
MarioLANG, 29 bytes

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

Try it online!

I know my code is sadly super-sad or angry:

>:(

Happy MarioLANG, 46 bytes

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

Try it online!

A happier approach:

 :)

Non-emotional MarioLANG, 41 bytes

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

Try it online!


答:
Pyth, 1 byte

```<code>S
</code>```

Body must be at least 30 characters; you entered 14.

Title: Count up folks!

Body:
Introduction

It may sound strange, but we haven't got ONE challenge for counting from 1 to n, inclusive.

This is not the same thing. That one is a (closed) not well-explained challenge.

This is not the same thing. That one is about counting up indefinitely.

Challenge

Write a program or function that prints every integer from 1 to n inclusive.

Rules

You can get n any way.

You can assume that n will always be a positive integer.

You can get n in any base, but you should always output in decimal.

Output must be separated by any character (or pattern) not in 0123456789. Non-decimal leading or trailing characters are allowed (for example when using arrays such as [1, 2, 3, 4, 5, 6]).

Standard loopholes are denied.

We want to find the shortest approach in each language, not the shortest language, so I will not accept any answer.

You must update your answer(s) after this edit, answers posted before the last edit must comply with the change rule about standard loopholes (I didn't want to deny them, but I didn't want to make the community roar, so I denied them).

You can use any post-dating language version (or language). You cannot use any language or language version made just for this challenge.

Bonuses

20%

Your program must be able to count at least up to 18446744073709551615 (2^64-1). For example, if a new datatype is the only way to support big integers, you must construct it. If your language does not have any way to support huge integers up to 2^64-1, the upper limit of that particular language must be supported instead.

EDIT: I've changed the limit from 2^64 to 2^64-1 to allow more answers.

EDIT: I made the 2^64-1 rule a bonus, since there has not been much interest in this challenge. If your answer supports 2^64-1, you can now edit it to include the bonus. Also, you can post an answer not supporting it, if it is shorter.

Body:
Pyth, 1 byte

S

Body must be at least 30 characters; you entered 14.


答:
05AB1E, 1 byte

Code:

```<code>L
</code>```

Try it online!.

A more interesting approach:

```<code>FN>,
</code>```

Explanation:

```<code>F     # For N in range(0, input):
 N>   #   Push N + 1
   ,  #   Pop and print with a newline
</code>```

Try it online!.

Title: Count up folks!

Body:
05AB1E, 1 byte

Code:

L

Try it online!.

A more interesting approach:

FN>,

Explanation:

F     # For N in range(0, input):
 N>   #   Push N + 1
   ,  #   Pop and print with a newline

Try it online!.


答:
Python 2, <s>37</s> <s>33</s> <s>32</s> 33 bytes

```<code>for i in xrange(input()):print-~i
</code>```

Presumably works up to 2**64 and beyond.

Shot down four bytes thanks to @dieter, and another thanks to @orlp. But apparently, as @Sp3000 found out, range() might have issues with higher values, so the function was changed to xrange(). Note: even xrange() might have issues, at least in 2.7.10.

Title: Count up folks!

Body:
Python 2, <s>37</s> <s>33</s> <s>32</s> 33 bytes

for i in xrange(input()):print-~i

Presumably works up to 2**64 and beyond.

Shot down four bytes thanks to @dieter, and another thanks to @orlp. But apparently, as @Sp3000 found out, range() might have issues with higher values, so the function was changed to xrange(). Note: even xrange() might have issues, at least in 2.7.10.


答:
Cjam, 5 bytes

```<code>{,:)}
</code>```

Try it online!

This is an unnamed block which expects n on the stack and leaves a list with the range [1...n] on it.

Works by just building the range with , and then incrementing every range element with :) to make the range one-based.

Title: Count up folks!

Body:
Cjam, 5 bytes

{,:)}

Try it online!

This is an unnamed block which expects n on the stack and leaves a list with the range [1...n] on it.

Works by just building the range with , and then incrementing every range element with :) to make the range one-based.


答:
Javascript <s>182</s> <s>177</s> <s>160</s> <s>154</s> <s>139</s> <s>138</s> 132 bytes (valid)

1 byte saved thanks to @ShaunH

```<code>n=>{c=[e=0];for(;c.join``!=n;){a=c.length-1;c[a]++;for(;a+1;a--){c[a]+=e;e=0;if(c[a]>9)c[a]=0,e++;}e&&c.unshift(1);alert(c.join``)}}
</code>```

Arbitary precision to the rescue!

Because javascript can only count up to 2^53-1 (Thanks goes to @MartinBüttner for pointing it out), I needed to create arbitary precision to do this. It stores data in an array, and each "tick" it adds 1 to the last element, then goes trough the array, and if something exceedes 9, it sets that element to 0, and adds 1 to the one on the left hand.

Try it here! Note: press F12, to actually see the result, as I didn't want to make you wait for textboxes.

BTW.: I was the only one, who didn't know, ternary operators are so useful in codegolf?

```<code>if(statement)executeSomething();
</code>```

is longer than

```<code>statement?executeSomething():0;
</code>```

by 1 byte.

Javascript, 28 bytes (invalid - can't count to 264)

```<code>n=>{for(i=0;i++<n;)alert(i)}
</code>```

Title: Count up folks!

Body:
Javascript <s>182</s> <s>177</s> <s>160</s> <s>154</s> <s>139</s> <s>138</s> 132 bytes (valid)

1 byte saved thanks to @ShaunH

n=>{c=[e=0];for(;c.join``!=n;){a=c.length-1;c[a]++;for(;a+1;a--){c[a]+=e;e=0;if(c[a]>9)c[a]=0,e++;}e&&c.unshift(1);alert(c.join``)}}

Arbitary precision to the rescue!

Because javascript can only count up to 2^53-1 (Thanks goes to @MartinBüttner for pointing it out), I needed to create arbitary precision to do this. It stores data in an array, and each "tick" it adds 1 to the last element, then goes trough the array, and if something exceedes 9, it sets that element to 0, and adds 1 to the one on the left hand.

Try it here! Note: press F12, to actually see the result, as I didn't want to make you wait for textboxes.

BTW.: I was the only one, who didn't know, ternary operators are so useful in codegolf?

if(statement)executeSomething();

is longer than

statement?executeSomething():0;

by 1 byte.

Javascript, 28 bytes (invalid - can't count to 264)

n=>{for(i=0;i++<n;)alert(i)}


答:
MATLAB, 7 bytes

An unnamed anonymous function:

```<code>@(n)1:n
</code>```

Run as:

```<code>ans(10)
ans =
     1     2     3     4     5     6     7     8     9    10
</code>```

Test it here!

If a full program is required, 17 bytes:

```<code>disp(1:input(''))
10
     1     2     3     4     5     6     7     8     9    10
</code>```

Test it here!

Title: Count up folks!

Body:
MATLAB, 7 bytes

An unnamed anonymous function:

@(n)1:n

Run as:

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

Test it here!

If a full program is required, 17 bytes:

disp(1:input(''))
10
     1     2     3     4     5     6     7     8     9    10

Test it here!


答:
R, 13 bytes

```<code>cat(1:scan())
</code>```

Body must be at least 30 characters.

Title: Count up folks!

Body:
R, 13 bytes

cat(1:scan())

Body must be at least 30 characters.


答:
MATL, 1 byte

```<code>:
</code>```

Example output:

```<code>15
1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
</code>```

Try it online here

Title: Count up folks!

Body:
MATL, 1 byte

:

Example output:

15
1  2  3  4  5  6  7  8  9 10 11 12 13 14 15

Try it online here


答:
Jelly, 1 byte

```<code>R
</code>```

Try it online!

Title: Count up folks!

Body:
Jelly, 1 byte

R

Try it online!


答:
Pyth - <s>3</s> 2 bytes

1 bytes saved thanks to @DenkerAffe.

Without using the builtin.

```<code>hM
</code>```

Try it online.

Title: Count up folks!

Body:
Pyth - <s>3</s> 2 bytes

1 bytes saved thanks to @DenkerAffe.

Without using the builtin.

hM

Try it online.


答:
Pyke, 1 byte

```<code>S
</code>```

Try it here!

Or 2 bytes without the builtin

```<code>mh
</code>```

Try it here!

```<code>#h
</code>```

Try it here!

```<code>Lh
</code>```

Try it here!

Title: Count up folks!

Body:
Pyke, 1 byte

S

Try it here!

Or 2 bytes without the builtin

mh

Try it here!

#h

Try it here!

Lh

Try it here!


答:
REXX 37

```<code>s='ATCGCGAT';say s=translate(reverse(s),'ATCG','TAGC')
</code>```

Title: Watson-Crick palindromes

Body:
Problem

Create a function that can determine whether or not an arbitrary DNA string is a Watson-Crick palindrome. The function will take a DNA string and output a true  value if the string is a Watson-Crick palindrome and a false value if it is not. (True and False can also be represented as 1 and 0, respectively.)

The DNA string may either be in all uppercase or all lowercase depending on your preference.

Also, the DNA string will not be empty.

Explanation

A DNA string is a Watson-Crick palindrome when the complement of its reverse is equal to itself.

Given a DNA string, first reverse it, and then complement each character according to the DNA bases (A ↔ T and C ↔ G). If the original string is equal to the complemented-reverse string, it is a Watson-Crick palindrome.

For more, see this question. It is a different challenge where you must find the longest substring of a DNA string where that substring is a Watson-Crick palindrome.

Goal

This is code-golf and the shortest code wins.

Test Cases

The format is <input> = <output>.

```<code>ATCGCGAT = true
AGT = false
GTGACGTCAC = true
GCAGTGA = false
GCGC = true
AACTGCGTTTAC = false
ACTG = false
</code>```

Body:
REXX 37

s='ATCGCGAT';say s=translate(reverse(s),'ATCG','TAGC')


问:
Taylor Series of a Function with Periodic Derivatives
Taylor series are a very useful tool in calculating values of analytic functions that cannot be expressed in terms of elementary functions, using only information about that function at a single point.

In this challenge, you won't be actually doing any math with them, but merely making string representations of taylor series of functions with periodic derivatives.

Specs

You will takes a input three things:

A cycle of the derivatives of the function, including the original function as a list of strings, e.g. ["sin(x)", "cos(x)", "-sin(x)", "-cos(x)"].

A number a, the point around which to center the approximation.

A positive integer n, the number of terms of the series to output.

The general form for the nth term of a taylor series is:

```<code>f^(n)(a)/n!*(x-a)^n
</code>```

where f^(n) is the nth derivative of f. Here is the taylor series of f in a better formatted image from wikipedia:

.

The above example with sin(x), and a of 1, and n of 6, would have an output of:

```<code>sin(1) + cos(1)*(x-1) - sin(1)/2*(x-1)^2 - cos(1)/6*(x-1)^3 + sin(1)/24*(x-1)^4 + cos(1)/120*(x-1)^5
</code>```

You can do the whitespace want. However, you have to replace + - and - - with - and + respectively. Also, if the series is a maclaurin series, and a is 0, you cannot have (x-0). (x) and just x is fine, but not (x-0). Niether can you have ^0 nor ^1 nor /1 . Additionally, you must expand out the factorials in the denominators. Multiplication by juxtaposition is not allowed.

Test cases

```<code>["e^x"], 0, 4  ->  e^0 + e^0*x + e^0*x^2/2 + e^0*x^3/6
["sin(x)", "cos(x)", "-sin(x)", "-cos(x)"], 1, 6 -> sin(1) + cos(1)*(x-1) - sin(1)/2*(x-1)^2 - cos(1)/6*(x-1)^3 + sin(1)/24*(x-1)^4 + cos(1)/120*(x-1)^5
["e^(i*x)", "i * e^(i*x)", "-e^(i*x)", "-i*e^(i*x)"], 0, 7 -> e^(i*0) + i*e^(i*0)*x - e^(i*0)*x^2/2 - i*e^(i*0)*x^3/6 + e^(i*0)*x^4/24 + i*e^(i*0)*x^5/120 - e^(i*0)*x^6/720
</code>```

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

答:
JavaScript (ES6), 183 bytes

```<code>(c,a,n)=>[...Array(n)].map((_,i)=>(s=c[i%c.length].replace(/x/g,a),i?s=s.replace(/^-?/,c=>c?` - `:` + `)+(a>0?`*(x-${a})`:a<0?`*(x+${-a})`:`*x`):s,i>1?s+`^${i}/${f*=i}`:s),f=1).join``
</code>```

Lots of tedious string manipulation. Explanation:

```<code>(c,a,n)=>                               Parameters
 [...Array(n)].map((_,i)=>(             Loop i from 0 to n-1
  s=c[i%c.length]                       Get the right element from the cycle
   .replace(/x/g,a),                    Substitute a in for x
  i?                                    If i > 0
   s=s.replace(/^-?/,c=>c?` - `:` + `)  Turn the sign into an operator
    +(a>0?`*(x-${a})`                   If a > 0 then * (x - a)
     :a<0?`*(x+${-a})`                  If a < 0 then * (x + -a)
     :`*x`)                             If a == 0 then * x
   :s,                                  No change if i < 1
  i>1?                                  If i > 1
   s+`^${i}/${f*=i}`                    Append ^ i / i!
   :s),                                 No change if i < 2
  f=1                                   0! == 1
 ).join``                               Join all the results together
</code>```

170 bytes if you remove all the whitespace:

```<code>(c,a,n)=>[...Array(n)].map((_,i)=>(s=c[i%c.length].replace(/x/g,a),i?s=(s[0]=='-'?'':'+')+s+(a>0?`*(x-${a})`:a<0?`*(x+${-a})`:`*x`):s,i>1?s+`^${i}/${f*=i}`:s),f=1).join``
</code>```

Body:
JavaScript (ES6), 183 bytes

(c,a,n)=>[...Array(n)].map((_,i)=>(s=c[i%c.length].replace(/x/g,a),i?s=s.replace(/^-?/,c=>c?` - `:` + `)+(a>0?`*(x-${a})`:a<0?`*(x+${-a})`:`*x`):s,i>1?s+`^${i}/${f*=i}`:s),f=1).join``

Lots of tedious string manipulation. Explanation:

(c,a,n)=>                               Parameters
 [...Array(n)].map((_,i)=>(             Loop i from 0 to n-1
  s=c[i%c.length]                       Get the right element from the cycle
   .replace(/x/g,a),                    Substitute a in for x
  i?                                    If i > 0
   s=s.replace(/^-?/,c=>c?` - `:` + `)  Turn the sign into an operator
    +(a>0?`*(x-${a})`                   If a > 0 then * (x - a)
     :a<0?`*(x+${-a})`                  If a < 0 then * (x + -a)
     :`*x`)                             If a == 0 then * x
   :s,                                  No change if i < 1
  i>1?                                  If i > 1
   s+`^${i}/${f*=i}`                    Append ^ i / i!
   :s),                                 No change if i < 2
  f=1                                   0! == 1
 ).join``                               Join all the results together

170 bytes if you remove all the whitespace:

(c,a,n)=>[...Array(n)].map((_,i)=>(s=c[i%c.length].replace(/x/g,a),i?s=(s[0]=='-'?'':'+')+s+(a>0?`*(x-${a})`:a<0?`*(x+${-a})`:`*x`):s,i>1?s+`^${i}/${f*=i}`:s),f=1).join``


答:
Mathematica, 5 bytes

```<code>Range
</code>```

Simple enough.

Title: Count up folks!

Body:
Mathematica, 5 bytes

Range

Simple enough.


问:
Linear Independence
Given a set of vectors all of the same positive finite dimension, output a falsey value if they are linearly dependent and a truthy value if they are linearly independent. A set of vectors v1, v2, ... is linearly dependent if for some scalars a1, a2, ... not all equal to 0,  a1v1 + a2v2 + ... = 0. (0 is the zero vector.)

Note: Using an inbuilt function to find the rank of a matrix or test vectors for linear dependence is not allowed.

Note 2: All input will be formed from integers.

Test cases (input -> output):

```<code>[[0,1],[2,3]] -> True
[[1,2],[2,4]] -> False
[[2,6,8],[3,9,12]] -> False
[[1,2],[2,3],[3,4]] -> False
[[1,0,0],[0,1,0],[0,0,1]] -> True
[[0]] -> False
[] -> True
[[1,1],[0,1],[1,0]] -> False
[[1,2,3],[1,3,5],[0,0,0]] -> False
</code>```

答:
Jelly, <s>5</s> 2 bytes

```<code>ÆḊ
</code>```

Try it online!

Title: Linear Independence

Body:
Jelly, <s>5</s> 2 bytes

ÆḊ

Try it online!


Title: Taylor Series of a Function with Periodic Derivatives

Body:
Taylor series are a very useful tool in calculating values of analytic functions that cannot be expressed in terms of elementary functions, using only information about that function at a single point.

In this challenge, you won't be actually doing any math with them, but merely making string representations of taylor series of functions with periodic derivatives.

Specs

You will takes a input three things:

A cycle of the derivatives of the function, including the original function as a list of strings, e.g. ["sin(x)", "cos(x)", "-sin(x)", "-cos(x)"].

A number a, the point around which to center the approximation.

A positive integer n, the number of terms of the series to output.

The general form for the nth term of a taylor series is:

```<code>f^(n)(a)/n!*(x-a)^n
</code>```

where f^(n) is the nth derivative of f. Here is the taylor series of f in a better formatted image from wikipedia:

.

The above example with sin(x), and a of 1, and n of 6, would have an output of:

```<code>sin(1) + cos(1)*(x-1) - sin(1)/2*(x-1)^2 - cos(1)/6*(x-1)^3 + sin(1)/24*(x-1)^4 + cos(1)/120*(x-1)^5
</code>```

You can do the whitespace want. However, you have to replace + - and - - with - and + respectively. Also, if the series is a maclaurin series, and a is 0, you cannot have (x-0). (x) and just x is fine, but not (x-0). Niether can you have ^0 nor ^1 nor /1 . Additionally, you must expand out the factorials in the denominators. Multiplication by juxtaposition is not allowed.

Test cases

```<code>["e^x"], 0, 4  ->  e^0 + e^0*x + e^0*x^2/2 + e^0*x^3/6
["sin(x)", "cos(x)", "-sin(x)", "-cos(x)"], 1, 6 -> sin(1) + cos(1)*(x-1) - sin(1)/2*(x-1)^2 - cos(1)/6*(x-1)^3 + sin(1)/24*(x-1)^4 + cos(1)/120*(x-1)^5
["e^(i*x)", "i * e^(i*x)", "-e^(i*x)", "-i*e^(i*x)"], 0, 7 -> e^(i*0) + i*e^(i*0)*x - e^(i*0)*x^2/2 - i*e^(i*0)*x^3/6 + e^(i*0)*x^4/24 + i*e^(i*0)*x^5/120 - e^(i*0)*x^6/720
</code>```

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

Body:
Python 2, 181 bytes

D,a,N=input()
D=["+"*(d[0]!="-")+d.replace("x",`a`)for d in D]
x=a and"*(x-%s)"%a or"*x"
r=D[0][1:]+(D[1]+x)*(N>1)
n=f=2
while n<N:r+=D[n%len(D)]+"/"+`f`+x+"^"+`n`;n+=1;f*=n
print r


问:
Showcase of Languages

Notes

This thread is open and unlocked only because the community decided to make an exception. Please do not use this question as evidence that you can ask similar questions here. Please do not create additional showcase questions.

This is no longer a popularity-contest, nor are snippet lengths limited by the vote tally. If you know this thread from before, please make sure you familiarize yourself with the changes.

This thread is dedicated to showing off interesting, useful, obscure, and/or unique features your favorite programming languages have to offer. This is neither a challenge nor a competition, but a collaboration effort to showcase as many programming languages as possible as well as possible.

How this works

All answers should include the name of the programming language at the top of the post, prefixed by a #.

Answers may contain one (and only one) factoid, i.e., a couple of sentences without code that describe the language.

Aside from the factoid, answers should consist of snippets of code, which can (but don't have to be) programs or functions.

The snippets do not need to be related. In fact, snippets that are too related may be redundant.

Since this is not a contest, all programming languages are welcome, whenever they were created.

Answers that contain more than a handful of code snippets should use a Stack Snippet to collapse everything except the factoid and one of the snippets.

Whenever possible, there should be only one answer per programming language. This is a community wiki, so feel free to add snippets to any answer, even if you haven't created it yourself. There is a Stack Snippet for compressing posts, which should mitigate the effect of the 30,000 character limit.

Answers that predate these guidelines should be edited. Please help updating them as needed.

Current answers, sorted alphabetically by language name

$.ajax({type:"GET",url:"https://api.stackexchange.com/2.2/questions/44680/answers?site=codegolf&filter=withbody",success:function(data){for(var i=0;i<data.items.length;i++){var temp=document.createElement('p');temp.innerHTML = data.items[i].body.split("\n")[0];$('#list').append('
' + temp.innerText || temp.textContent + '');}}})```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><base href="http://codegolf.stackexchange.com"><ul id="list"></ul></code>```

答:
Molecule

Factoid

Molecule is the descendent of Pylongolf2, a descendent of Pylongolf which was based on CJam.

0 byte snippet:

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

This does not do anything as it is empty.

1 byte snippet:

```<code>I
</code>```

I read the input.

As Molecule outputs everything in the stack once the program shuts down, this makes a decent cat program.

2 byte snippet:

```<code>()
</code>```

Anything between ( and ) is looped until ! is called.

3 byte snippet:

```<code>Inh
</code>```

Read the input, convert it into a number.

The h converts numbers into characters.

So you can get some funky characters by using this.

4 byte snippet:

```<code>`q`n
</code>```

Now here's where you could break the program.

Molecule has a built-in reflections system that allows you to modify the source code at runtime.

`q</code> Push the source code, <code>`n sets the source code to itself.

From v5.5, this snippet forces the interpreter to read from the start, creating a loop.

5 byte snippet:

```<code>0(1+~)
</code>```

Have your program count until it reaches Infinity.. then it crashes.

(On my computer takes about 2 minutes to crash :P)

6 byte snippet:

```<code>u10000
</code>```

Print 10000. What is so interesting about this?

It's interesting because putting a simple 10000 will push 1 and 5 zeroes to the stack, while the u keyword pushes the entire number after it.

Title: Showcase of Languages

Body:
Molecule

Factoid

Molecule is the descendent of Pylongolf2, a descendent of Pylongolf which was based on CJam.

0 byte snippet:

This does not do anything as it is empty.

1 byte snippet:

I

I read the input.

As Molecule outputs everything in the stack once the program shuts down, this makes a decent cat program.

2 byte snippet:

()

Anything between ( and ) is looped until ! is called.

3 byte snippet:

Inh

Read the input, convert it into a number.

The h converts numbers into characters.

So you can get some funky characters by using this.

4 byte snippet:

`q`n

Now here's where you could break the program.

Molecule has a built-in reflections system that allows you to modify the source code at runtime.

`q</code> Push the source code, <code>`n sets the source code to itself.

From v5.5, this snippet forces the interpreter to read from the start, creating a loop.

5 byte snippet:

0(1+~)

Have your program count until it reaches Infinity.. then it crashes.

(On my computer takes about 2 minutes to crash :P)

6 byte snippet:

u10000

Print 10000. What is so interesting about this?

It's interesting because putting a simple 10000 will push 1 and 5 zeroes to the stack, while the u keyword pushes the entire number after it.


答:
V, 11 Bytes

```<code>é1@añYpñdd
</code>```

Since this contains nasty UTF-8 and unprintables, here is a reversible hexdump:

```<code>00000000: e931 4061 f159 7001 f164 64              .1@a.Yp..dd
</code>```

V is an unfinished  language I wrote, but this is working as of commit 19. This answer was a little more verbose than I'd like, but that's mostly because V has no knowledge of integers, only strings. So it's a decent answer! This will work up to 2^64, but it will probably take a very long time.

To make my explanation easier to read/write, I will work with this "Human readable form", which is actually how you would type this in vim.

```<code><A-i>1@a<A-q>Yp<C-a><A-q>dd
</code>```

Explanation:

```<code>'Implicit: register "a" == arg 1, and any generated text is printed.

<A-i>1                       'Insert a single character: "1"
      @a                     ' "a" times,
        <A-q>       <A-q>    'Repeat the following:
             Yp<C-a>         'Duplicate the line, and increment it
                         dd  'Delete the last line, since we have one too many.
</code>```

If loopholes are allowed, here's a shorter version that prints 1 to n, but also prints a 0 (8 bytes):

```<code>é0@añYp
</code>```

And in readable form:

```<code><A-i>1@a<A-q>Yp<C-a>
</code>```

This is shorter because the  at the end is implicit, so we don't need it if we don't have to delete the last line.

Title: Count up folks!

Body:
Introduction

It may sound strange, but we haven't got ONE challenge for counting from 1 to n, inclusive.

This is not the same thing. That one is a (closed) not well-explained challenge.

This is not the same thing. That one is about counting up indefinitely.

Challenge

Write a program or function that prints every integer from 1 to n inclusive.

Rules

You can get n any way.

You can assume that n will always be a positive integer.

You can get n in any base, but you should always output in decimal.

Output must be separated by any character (or pattern) not in 0123456789. Non-decimal leading or trailing characters are allowed (for example when using arrays such as [1, 2, 3, 4, 5, 6]).

Standard loopholes are denied.

We want to find the shortest approach in each language, not the shortest language, so I will not accept any answer.

You must update your answer(s) after this edit, answers posted before the last edit must comply with the change rule about standard loopholes (I didn't want to deny them, but I didn't want to make the community roar, so I denied them).

You can use any post-dating language version (or language). You cannot use any language or language version made just for this challenge.

Bonuses

20%

Your program must be able to count at least up to 18446744073709551615 (2^64-1). For example, if a new datatype is the only way to support big integers, you must construct it. If your language does not have any way to support huge integers up to 2^64-1, the upper limit of that particular language must be supported instead.

EDIT: I've changed the limit from 2^64 to 2^64-1 to allow more answers.

EDIT: I made the 2^64-1 rule a bonus, since there has not been much interest in this challenge. If your answer supports 2^64-1, you can now edit it to include the bonus. Also, you can post an answer not supporting it, if it is shorter.

Body:
V, 11 Bytes

é1@añYpñdd

Since this contains nasty UTF-8 and unprintables, here is a reversible hexdump:

00000000: e931 4061 f159 7001 f164 64              .1@a.Yp..dd

V is an unfinished  language I wrote, but this is working as of commit 19. This answer was a little more verbose than I'd like, but that's mostly because V has no knowledge of integers, only strings. So it's a decent answer! This will work up to 2^64, but it will probably take a very long time.

To make my explanation easier to read/write, I will work with this "Human readable form", which is actually how you would type this in vim.

<A-i>1@a<A-q>Yp<C-a><A-q>dd

Explanation:

'Implicit: register "a" == arg 1, and any generated text is printed.

<A-i>1                       'Insert a single character: "1"
      @a                     ' "a" times,
        <A-q>       <A-q>    'Repeat the following:
             Yp<C-a>         'Duplicate the line, and increment it
                         dd  'Delete the last line, since we have one too many.

If loopholes are allowed, here's a shorter version that prints 1 to n, but also prints a 0 (8 bytes):

é0@añYp

And in readable form:

<A-i>1@a<A-q>Yp<C-a>

This is shorter because the <A-q> at the end is implicit, so we don't need it if we don't have to delete the last line.


答:
Perl 5, 15 bytes + 8

Works with the -l and -Mbigint switch, and should work up to 2^64 with BigInt.
Thanks to @andlrc for the 7 bytes shaved off.

```<code>print for 1..<>
</code>```

Title: Count up folks!

Body:
Perl 5, 15 bytes + 8

Works with the -l and -Mbigint switch, and should work up to 2^64 with BigInt.
Thanks to @andlrc for the 7 bytes shaved off.

print for 1..<>


答:
Go, 90 bytes

Naive solution:

```<code>package main
import ."fmt"
func main(){var n,b uint64
Scan(&n)
for;b<n;b++{Println(b+1)}}
</code>```

Title: Count up folks!

Body:
Go, 90 bytes

Naive solution:

package main
import ."fmt"
func main(){var n,b uint64
Scan(&n)
for;b<n;b++{Println(b+1)}}


答:
MarioLANG, 19 bytes

```<code>;
)<
+"
:[
(-
>!
=#
</code>```

Try it online!

Vertical programs are usually more golfable for simple loops in MarioLANG. I'm not sure what the interpreter does when encountering [ inside an elevator, but it seems to terminate the program when the current cell is 0. That's probably a useful trick in general.

Explanation

MarioLANG is a Brainfuck-like language (with an infinite memory tape of arbitrary-precision integers) where the instruction pointer resembles Mario walking and jumping around.

Mario starts in the top left corner and falls downward. ; reads an integer from STDIN and places it in the current memory cell. Now note that = is a ground cell for Mario to walk on, the " and # form an elevator (with # being the start) and ! makes mario stop on the elevator so that he doesn't walk off right away. The > and < set his movement direction. We can see that this gives a simple loop, containing the following code:

```<code>)   Move memory pointer one cell right.
+   Increment (initially zero).
:   Print as integer, followed by a space.
(   Move memory pointer one cell left.
-   Decrement.
[   Conditional, see below.
</code>```

Now normally [ would conditionally make Mario skip the next depending on whether the current cell is zero or not. That is, as long as the counter is non-zero this does nothing. However, it seems that when Mario encounters a [ while riding an elevator and the current cell is 0, the program simply terminates immediately with an error, which means we don't even need to find a way to redirect him correctly.

Title: Count up folks!

Body:
MarioLANG, 19 bytes

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

Try it online!

Vertical programs are usually more golfable for simple loops in MarioLANG. I'm not sure what the interpreter does when encountering [ inside an elevator, but it seems to terminate the program when the current cell is 0. That's probably a useful trick in general.

Explanation

MarioLANG is a Brainfuck-like language (with an infinite memory tape of arbitrary-precision integers) where the instruction pointer resembles Mario walking and jumping around.

Mario starts in the top left corner and falls downward. ; reads an integer from STDIN and places it in the current memory cell. Now note that = is a ground cell for Mario to walk on, the " and # form an elevator (with # being the start) and ! makes mario stop on the elevator so that he doesn't walk off right away. The > and < set his movement direction. We can see that this gives a simple loop, containing the following code:

)   Move memory pointer one cell right.
+   Increment (initially zero).
:   Print as integer, followed by a space.
(   Move memory pointer one cell left.
-   Decrement.
[   Conditional, see below.

Now normally [ would conditionally make Mario skip the next depending on whether the current cell is zero or not. That is, as long as the counter is non-zero this does nothing. However, it seems that when Mario encounters a [ while riding an elevator and the current cell is 0, the program simply terminates immediately with an error, which means we don't even need to find a way to redirect him correctly.


问:
Count up forever
Write a program that counts up forever, starting from one.

Rules:

Your program must log to STDOUT or an acceptable alternative, if STDOUT is not available.

Your program must be a full, runnable program, and not a function or snippet.

Your program must output each number with a separating character in between (a newline, space, tab or comma), but this must be consistent for all numbers.

You may print the numbers in decimal, in unary or in base 256 where each digit is represented by a byte value.

Your program must count at least as far as 2128 (inclusive) without problems and without running out of memory on a reasonable desktop PC. In particular, this means if you're using unary, you cannot store a unary representation of the current number in memory.

Unlike our usual rules, 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.

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.

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

```

答:
C++, 72 bytes

Different from the other C++ answer, as it only uses the std library.

Golfed:

#include<iostream>
int main(){for(int c=0;c>=0;c++,std::cout<<c<<"\n");}
```

<h3>Ungolfed:</h3>

<pre class="lang-cpp prettyprint-override"><code>#include<iostream>
int main(){
    for(int c = 0; c >= 0; c++){
        std::cout<<c<<"\n";
    }
}
</code>```

Title: Count up forever

Body:
C++, 72 bytes

Different from the other C++ answer, as it only uses the std library.

Golfed:

#include<iostream>
int main(){for(int c=0;c>=0;c++,std::cout<<c<<"\n");}

Ungolfed:

#include<iostream>
int main(){
    for(int c = 0; c >= 0; c++){
        std::cout<<c<<"\n";
    }
}


答:
Julia, 11 bytes

n->[1:n...]
```

This is an anonymous function that accepts an integer and returns an array from 1 to the input. This can handle large inputs just fine, it just requires passing n as a larger type, e.g. Int128 or BigInt.

Title: Count up folks!

Body:
Julia, 11 bytes

n->[1:n...]

This is an anonymous function that accepts an integer and returns an array from 1 to the input. This can handle large inputs just fine, it just requires passing n as a larger type, e.g. Int128 or BigInt.


答:
Fuzzy Octo Guacamole, 4 bytes

```<code>(+X)
</code>```

Explanation:

```<code>(+X)
(  )    # Infinite loop.
 +      # Increment ToS, which is 0 by default.
  X     # Print ToS.
        # Implicit output applies to the end of a loop.
</code>```

Title: Count up forever

Body:
Write a program that counts up forever, starting from one.

Rules:

Your program must log to STDOUT or an acceptable alternative, if STDOUT is not available.

Your program must be a full, runnable program, and not a function or snippet.

Your program must output each number with a separating character in between (a newline, space, tab or comma), but this must be consistent for all numbers.

You may print the numbers in decimal, in unary or in base 256 where each digit is represented by a byte value.

Your program must count at least as far as 2128 (inclusive) without problems and without running out of memory on a reasonable desktop PC. In particular, this means if you're using unary, you cannot store a unary representation of the current number in memory.

Unlike our usual rules, 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.

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.

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

```

Body:
Fuzzy Octo Guacamole, 4 bytes

(+X)

Explanation:

(+X)
(  )    # Infinite loop.
 +      # Increment ToS, which is 0 by default.
  X     # Print ToS.
        # Implicit output applies to the end of a loop.


Title: Count up folks!

Body:
PHP, 32 bytes

for(;$i!=$argv[1];)echo++$i." ";

<s>57 Bytes

$c=function($e){$i=0;while($i!=$e)echo ++$i." ";};$c(10);

</s>


答:
AWK, <s>25</s> 23 Bytes

```<code>{for(;j<=$1;)print++j}
</code>```

It seems like I should be able to make this smaller, but I can't seem to figure out how. :(

OK, I must have been asleep not to realize I could drop those braces... thanks Olivier.

An example usage would be to store this code in a file, FILE then do something along the lines of:

```<code>awk -f FILE <<< 4242342
</code>```

Title: Count up folks!

Body:
AWK, <s>25</s> 23 Bytes

{for(;j<=$1;)print++j}

It seems like I should be able to make this smaller, but I can't seem to figure out how. :(

OK, I must have been asleep not to realize I could drop those braces... thanks Olivier.

An example usage would be to store this code in a file, FILE then do something along the lines of:

awk -f FILE <<< 4242342


答:
AutoHotKey, 34 bytes

Golfed and Ungolfed is the same.

Golfed:

```<code>c:=0
Loop {
    c:=c+1
    tooltip %c%
}
</code>```

Ungolfed:

```<code>c:=0
Loop {
    c:=c+1
    tooltip %c%
}
</code>```

Title: Count up forever

Body:
AutoHotKey, 34 bytes

Golfed and Ungolfed is the same.

Golfed:

c:=0
Loop {
    c:=c+1
    tooltip %c%
}

Ungolfed:

c:=0
Loop {
    c:=c+1
    tooltip %c%
}