问:
Simplify a continued fraction
Continued fractions are expressions that describe fractions iteratively. They can be represented graphically:

$$
a_0 +\cfrac 1
 {a_1 + \cfrac 1
  {a_2 + \cfrac 1
   {\ddots + \cfrac 1
    {a_n}
   }
  }
 }
$$

Or they can be represented as a list of values: \$[a_0 ; a_1, a_2, \dots, a_n]\$

The challenge:

take a base number: \$a_0\$ and a list of denominator values: \$[a_1, a_2, \dots, a_n]\$ and simplify the continued fraction to a simplified rational fraction: return or print numerator and denominator separately.

Examples:

\$\sqrt 19\$: [4;2,1,3,1,2]: 170/39

\$e\$: [1;0,1,1,2,1,1]: 19/7

\$\pi\$: [3;7,15,1,292,1]: 104348/33215

\$ϕ\$: [1;1,1,1,1,1]: 13/8

Example implementation: (python)

def foo(base, sequence):
    numerator = 1
    denominator = sequence[-1]
    for d in sequence[-2::-1]:
        temp = denominator
        denominator = d * denominator + numerator
        numerator = temp
    return numerator + base * denominator, denominator```

Winning:
 shortest code in bytes: --no builtins that do the entire problem allowed--

答:
Zephyr, 145 bytes

```<code>input n as Integer
set a to Array(n)
for i from 1to n
input a[i]as Integer
next
set r to a[n]
for i from 1to n-1
set r to(/r)+a[n-i]
next
print r
</code>```

Zephyr is the first programming language I ever created. It was designed to be intuitive and have clean syntax--rather at the expense of brevity. Why am I golfing with it, you ask? Because, unlike any language I've written since, it has a built-in Fraction type. You can even use the division operator / as a unary operator for "inverse" (a feature I borrowed for Pip).

Now, there are significant limitations. The biggest problem for this challenge is that arrays must be defined with fixed size, which means that the program starts by reading the size of the array from the user. (I hope this is ok; the alternative is hardcoding the size.) There's also the minor problem that operator precedence doesn't exist, meaning multi-operator expressions have to have parentheses.

Here's an example run:

```<code>C:\Zephyr> python zephyr.py contfrac.zeph
6
1
1
1
1
1
1
13/8
</code>```

Title: Simplify a continued fraction

Body:
Zephyr, 145 bytes

input n as Integer
set a to Array(n)
for i from 1to n
input a[i]as Integer
next
set r to a[n]
for i from 1to n-1
set r to(/r)+a[n-i]
next
print r

Zephyr is the first programming language I ever created. It was designed to be intuitive and have clean syntax--rather at the expense of brevity. Why am I golfing with it, you ask? Because, unlike any language I've written since, it has a built-in Fraction type. You can even use the division operator / as a unary operator for "inverse" (a feature I borrowed for Pip).

Now, there are significant limitations. The biggest problem for this challenge is that arrays must be defined with fixed size, which means that the program starts by reading the size of the array from the user. (I hope this is ok; the alternative is hardcoding the size.) There's also the minor problem that operator precedence doesn't exist, meaning multi-operator expressions have to have parentheses.

Here's an example run:

C:\Zephyr> python zephyr.py contfrac.zeph
6
1
1
1
1
1
1
13/8


问:
Invert a boolean array
A nice simple one

Input

Given a boolean array (Or an acceptable alternative), you can assume the array will never be more than 32 elements long.

```<code>[false, false, true, false, false]
</code>```

Output

Invert every element of the array and output it.

```<code>[true, true, false, true, true]
</code>```

Rules

You can write a full program or just a function

Standard loopholes apply

Shortest code in bytes, per language, wins!

Test cases

```<code>Input:
[true, false]
Output:
[false, true]

Input: //Example of acceptable alternative
[0,1,1]
Output:
[1,0,0]
</code>```

答:
Stata, 20 bytes

```<code>recode x (0=1) (1=0)
</code>```

x is the input, and the rest is self-explanatory

ContentLicense: CC BY-SA 3.0

Title: Invert a boolean array

Body:
Stata, 20 bytes

recode x (0=1) (1=0)

x is the input, and the rest is self-explanatory


问:
Output the largest number with the fewest digits
Given a nonempty list of positive decimal integers, output the largest number from the set of numbers with the fewest digits.

The input list will not be in any particular order and may contain repeated values.

Examples:

```<code>[1] -> 1
[9] -> 9
[1729] -> 1729
[1, 1] -> 1
[34, 3] -> 3
[38, 39] -> 39
[409, 12, 13] -> 13
[11, 11, 11, 1] -> 1
[11, 11, 11, 11] -> 11
[78, 99, 620, 1] -> 1
[78, 99, 620, 10] -> 99
[78, 99, 620, 100] -> 99
[1, 5, 9, 12, 63, 102] -> 9
[3451, 29820, 2983, 1223, 1337] -> 3451
[738, 2383, 281, 938, 212, 1010] -> 938
</code>```

The shortest code in bytes wins.

答:
Perl, <s>38</s> 37 bytes

Includes +1 for -a

Give input on STDIN:

```<code>perl -M5.010 maxmin.pl <<< "3451 29820 2983 1223 1337"
</code>```

maxmin.pl:

```<code>#!/usr/bin/perl -a
\$G[99-y///c][$_]for@F;say$#{$G[-1]}
</code>```

Uses memory linear in the largest number, so don't try this on too large numbers. A solution without that flaw is 38 bytes:

```<code>#!/usr/bin/perl -p
$.++until$\=(sort/\b\S{$.}\b/g)[-1]}{
</code>```

All of these are very awkward and don't feel optimal at all...

Body:
Perl, <s>38</s> 37 bytes

Includes +1 for -a

Give input on STDIN:

perl -M5.010 maxmin.pl <<< "3451 29820 2983 1223 1337"

maxmin.pl:

#!/usr/bin/perl -a
\$G[99-y///c][$_]for@F;say$#{$G[-1]}

Uses memory linear in the largest number, so don't try this on too large numbers. A solution without that flaw is 38 bytes:

#!/usr/bin/perl -p
$.++until$\=(sort/\b\S{$.}\b/g)[-1]}{

All of these are very awkward and don't feel optimal at all...


问:
Produce n n-squares of integers with rotating *'s in consecuitive corners
The objective is to produce output of n squares (nxn) of random integers (0-9) with a moving * that rotates clockwise around the corners, starting from the top left. The squares should be side by side and separated by a single space.

If n = 0, the output should be empty.

Output for n=1:

*

Output for n=2:

```<code>*3 4*
14 07
</code>```

Output for n=3:

```<code>*34 82* 291
453 224 924
145 158 57*
</code>```

Output for n=4:

```<code>*153 135* 0154 0235
2352 5604 3602 2065
2245 6895 3561 7105
7225 5785 479* *662
</code>```

Notice how, for each square, the * rotates around the corners of the square, from left to right, beginning in the top left corner of the first, then moving to the top right of the second, and so on.

The shortest answer (measured in bytes) wins.

答:
Java 10, <s>370</s> ... <s>243</s> 242 bytes

n->{int j=n*n,k,m=1;var a=new String[j];var r="";for(m*=Math.pow(10,n-1);j-->0;a[j]=(k*=Math.random())+m+r)k=9*m;for(;++j<n;m=k<2?0:n*n-n,a[m+j]=a[m+j].replaceAll(k%3<1?"^.":".$","*"))k=j%4;for(j=0;j<n*n;r+=j%n<1?"\n":" ")r+=a[j++];return r;}
```
<p>Returns the result-String with trailing newline.</p>
<p>-51 bytes thanks to <em>@ceilingcat</em>.</p>
<p>Try it online.</p>
<p><strong>Explanation:</strong></p>
<pre class="lang-java prettyprint-override"><code>n->{                             // Method with integer parameter & String return-type
  int j=n*n,k,                   //  Index-integers
      m=1;                       //  Temp-integer
  var a=new String[j];           //  Create a String-matrix of size n by n
  var r="";                      //  Result-String, starting empty
  for(m*=Math.pow(10,n-1);       //  Start the temp-integer `m` at 10 to the power the
                                 //  input minus 1
      j-->0                      //  Loop `j` in the range [0,n²):
      ;                          //    After every iteration:
       a[j]=                     //     Set the j'th cell to:
         (k*=Math.random())      //      A random integer in the range [0,k)
         +m                      //      Add `m`
         +r;                     //      And then convert it to a String
    k=9*m;                       //   Set `k` to 9 multiplied by `m`, so the random
                                 //   integer will be in the range [0,9*m)
  for(;++j<n;                    //  Loop `j` in the range (-1,n):
      ;                          //    After every iteration:
       m=k<2?                    //     If `k` is 0 or 1:
             0                   //      Set `m` to 0 (first row)
            :                    //     Else:
             n*n-n,              //      Set `m` to n²-n instead (last row)
       a[m+j]=a[m+j].replaceAll( //     Then replace a digit in the (m*j)'th cell:
               k%3<1?            //      If `k` is 0 or 3 (first column):
                "^."             //       Replace its first digit
               :                 //      Else (last column instead):
                ".$",            //       Replace its last digit
               "*"))             //      And replace this digit with a "*"
    k=j%4;                       //   Set `k` to `j` modulo-4
  for(j=0;j<n*n;                 //  Loop `j` in the range [0,n²) again:
      ;                          //    After every iteration:
       r+=j%n<1?                 //     If `j` is divisible by `n`:
           "\n"                  //      Append a newline to the result
          :                      //     Else:
           " ";                  //      Append a space to the result instead
    r+=a[j++];                   //   Append the j'th value to the result
  return r;}                     //  Return the result-String
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Java 10, <s>370</s> ... <s>243</s> 242 bytes

n->{int j=n*n,k,m=1;var a=new String[j];var r="";for(m*=Math.pow(10,n-1);j-->0;a[j]=(k*=Math.random())+m+r)k=9*m;for(;++j<n;m=k<2?0:n*n-n,a[m+j]=a[m+j].replaceAll(k%3<1?"^.":".$","*"))k=j%4;for(j=0;j<n*n;r+=j%n<1?"\n":" ")r+=a[j++];return r;}

Returns the result-String with trailing newline.

-51 bytes thanks to @ceilingcat.

Try it online.

Explanation:

n->{                             // Method with integer parameter & String return-type
  int j=n*n,k,                   //  Index-integers
      m=1;                       //  Temp-integer
  var a=new String[j];           //  Create a String-matrix of size n by n
  var r="";                      //  Result-String, starting empty
  for(m*=Math.pow(10,n-1);       //  Start the temp-integer `m` at 10 to the power the
                                 //  input minus 1
      j-->0                      //  Loop `j` in the range [0,n²):
      ;                          //    After every iteration:
       a[j]=                     //     Set the j'th cell to:
         (k*=Math.random())      //      A random integer in the range [0,k)
         +m                      //      Add `m`
         +r;                     //      And then convert it to a String
    k=9*m;                       //   Set `k` to 9 multiplied by `m`, so the random
                                 //   integer will be in the range [0,9*m)
  for(;++j<n;                    //  Loop `j` in the range (-1,n):
      ;                          //    After every iteration:
       m=k<2?                    //     If `k` is 0 or 1:
             0                   //      Set `m` to 0 (first row)
            :                    //     Else:
             n*n-n,              //      Set `m` to n²-n instead (last row)
       a[m+j]=a[m+j].replaceAll( //     Then replace a digit in the (m*j)'th cell:
               k%3<1?            //      If `k` is 0 or 3 (first column):
                "^."             //       Replace its first digit
               :                 //      Else (last column instead):
                ".$",            //       Replace its last digit
               "*"))             //      And replace this digit with a "*"
    k=j%4;                       //   Set `k` to `j` modulo-4
  for(j=0;j<n*n;                 //  Loop `j` in the range [0,n²) again:
      ;                          //    After every iteration:
       r+=j%n<1?                 //     If `j` is divisible by `n`:
           "\n"                  //      Append a newline to the result
          :                      //     Else:
           " ";                  //      Append a space to the result instead
    r+=a[j++];                   //   Append the j'th value to the result
  return r;}                     //  Return the result-String


问:
"Sorry, young man, but it's Turtles all the way down!"

Execute a Lindenmayer System

A Lindenmayer System (or L-system) is related to Thue and Post systems, and is used in botanical modeling and fractal generation.

An L-system is described by string-rewriting where a symbol from the symbol-alphabet is mapped to a replacement sequence of symbols. A collection of these mappings constitutes the L-system proper.

The graphical output method as devised by Prusinkiewicz interprets the resulting sequence after the mappings have been applied to an initial sequence for a specified number of iterations, as Turtle-Drawing commands: forward, backward, left, right, that kind of stuff. This may require extra code to control the scale of the drawing as different iteration counts may produce drastically differently-sized images.

Your task is to execute an L-system in the fewest number of characters. Your program must be able to render both the Dragon Curve and the Branching Stems from the Wikipedia page by providing appropriate input (file, command-line, but external to the source, please).

This is code golf.

Edit: Here are some examples I've posted around town. answer to SO/rotate-to-north {Where I first discovered the L-system}, answer to SO/how-to-program-a-fractal, answer to SO/recursion-in-postscript, comp.lang.postscript discussion/recital, postscript l-system collection, codegolf.SE/draw-a-sierpinski-triangle {origin of the competition between myself and thomasW}.

答:
Mathematica 290

This bare-bones implementation focuses on the output rather than the processing.
It does not use production rules.  So it may not be a suitable response to the challenge.

Branching stems adapted from Theo Gray's demonstration.

Code

```<code>f@{a_, b_} := {{a, #}, {b, #}} &[a + (b - a)/2 + {{0, 1/2}, {-1/2, 0}}.(b - a)]; w = Flatten;
h[s_, g_] :=Graphics[If[s == 0,Line /@ Nest[w[f /@ #, 1] &, {{{0, 0}, {1, 0}}}, g],
 MapIndexed[Line@# &, NestList[w[Map[{{#[[2]], #[[2]] + m.(#[[2]] - #[[1]])}, {#[[2]],
 #[[2]] + ({{1, -1}, {-1,1}} m).(#[[2]] - #[[1]])}} &, #], 1] &, {{{0, -1}, {0, 0}}}, g]]]]
</code>```

Usage

The first parameter determines whether the Dragon Curve or Branch Stems will be displayed. The second term refers to the generation.

```<code>h[0, 5]
h[1, 5]
</code>```

More Examples

```<code>GraphicsGrid@Partition[Flatten[Table[h[j, k], {j, 0, 1}, {k, 10}]], 5]
</code>```

Body:
Mathematica 290

This bare-bones implementation focuses on the output rather than the processing.
It does not use production rules.  So it may not be a suitable response to the challenge.

Branching stems adapted from Theo Gray's demonstration.

Code

f@{a_, b_} := {{a, #}, {b, #}} &[a + (b - a)/2 + {{0, 1/2}, {-1/2, 0}}.(b - a)]; w = Flatten;
h[s_, g_] :=Graphics[If[s == 0,Line /@ Nest[w[f /@ #, 1] &, {{{0, 0}, {1, 0}}}, g],
 MapIndexed[Line@# &, NestList[w[Map[{{#[[2]], #[[2]] + m.(#[[2]] - #[[1]])}, {#[[2]],
 #[[2]] + ({{1, -1}, {-1,1}} m).(#[[2]] - #[[1]])}} &, #], 1] &, {{{0, -1}, {0, 0}}}, g]]]]

Usage

The first parameter determines whether the Dragon Curve or Branch Stems will be displayed. The second term refers to the generation.

h[0, 5]
h[1, 5]

More Examples

GraphicsGrid@Partition[Flatten[Table[h[j, k], {j, 0, 1}, {k, 10}]], 5]


答:
Ruby, 30 bytes

```<code>gets.split(?,).map{|e|!eval e}
</code>```

"true,false" outputs false,true.

Title: Invert a boolean array

Body:
A nice simple one

Input

Given a boolean array (Or an acceptable alternative), you can assume the array will never be more than 32 elements long.

```<code>[false, false, true, false, false]
</code>```

Output

Invert every element of the array and output it.

```<code>[true, true, false, true, true]
</code>```

Rules

You can write a full program or just a function

Standard loopholes apply

Shortest code in bytes, per language, wins!

Test cases

```<code>Input:
[true, false]
Output:
[false, true]

Input: //Example of acceptable alternative
[0,1,1]
Output:
[1,0,0]
</code>```

Body:
Ruby, 30 bytes

gets.split(?,).map{|e|!eval e}

"true,false" outputs false,true.


答:
MATL, 11 bytes

```<code>tV48\&XS0))
</code>```

Input is a column vector (using ; as separator), such as

```<code>[78; 99; 620; 100]
</code>```

Try it online! Or verify all test cases.

Explanation

Let's use input [78; 99; 620; 100] as an example.

```<code>t      % Input column vector implicitly. Duplicate
       %   STACK: [78; 99; 620; 100], [78; 99; 620; 100]
V      % Convert to string. Each number is a row, left-padded with spaces
       %   STACK: [78; 99; 620; 100], [' 78'; ' 99'; '620'; '100']
48\    % Modulo 48. This transforms each digit into the corresponding number,
       % and space into 32. Thus space becomes the largest "digit"
       %   STACK: [78; 99; 620; 100], [32 7 8; 32 9 9; 6 2 0; 1 0 0]
&XS    % Sort rows in lexicographical order, and push the indices of the sorting
       %   STACK: [78; 99; 620; 100], [4; 3; 1; 2]
0)     % Get last value
       %   STACK: [78; 99; 620; 100], 2
)      % Index
       %   STACK: 99
       % Implicitly display
</code>```

Title: Output the largest number with the fewest digits

Body:
Given a nonempty list of positive decimal integers, output the largest number from the set of numbers with the fewest digits.

The input list will not be in any particular order and may contain repeated values.

Examples:

```<code>[1] -> 1
[9] -> 9
[1729] -> 1729
[1, 1] -> 1
[34, 3] -> 3
[38, 39] -> 39
[409, 12, 13] -> 13
[11, 11, 11, 1] -> 1
[11, 11, 11, 11] -> 11
[78, 99, 620, 1] -> 1
[78, 99, 620, 10] -> 99
[78, 99, 620, 100] -> 99
[1, 5, 9, 12, 63, 102] -> 9
[3451, 29820, 2983, 1223, 1337] -> 3451
[738, 2383, 281, 938, 212, 1010] -> 938
</code>```

The shortest code in bytes wins.

Body:
MATL, 11 bytes

tV48\&XS0))

Input is a column vector (using ; as separator), such as

[78; 99; 620; 100]

Try it online! Or verify all test cases.

Explanation

Let's use input [78; 99; 620; 100] as an example.

t      % Input column vector implicitly. Duplicate
       %   STACK: [78; 99; 620; 100], [78; 99; 620; 100]
V      % Convert to string. Each number is a row, left-padded with spaces
       %   STACK: [78; 99; 620; 100], [' 78'; ' 99'; '620'; '100']
48\    % Modulo 48. This transforms each digit into the corresponding number,
       % and space into 32. Thus space becomes the largest "digit"
       %   STACK: [78; 99; 620; 100], [32 7 8; 32 9 9; 6 2 0; 1 0 0]
&XS    % Sort rows in lexicographical order, and push the indices of the sorting
       %   STACK: [78; 99; 620; 100], [4; 3; 1; 2]
0)     % Get last value
       %   STACK: [78; 99; 620; 100], 2
)      % Index
       %   STACK: 99
       % Implicitly display


问:
Print all integers
Write a program or function which will provably print all integers exactly once given infinite time and memory.

Possible outputs could be:

```<code>0, 1, -1, 2, -2, 3, -3, 4, -4, …

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9, 10, 11, …
</code>```

This is not a valid output, as this would never enumerate negative numbers:

<s>```0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …```</s>

The output must be in decimal, unless your language does not support decimal integer (in that case use the natural representation of integers your language uses).

Your program has to work up to the numbers with the biggest magnitude of the standard integer type of your language.

Each integer must be separated from the next using any separator (a space, a comma, a linebreak, etc.) that is not a digit nor the negative sign of your language.

The separator must not change at any point.

The separator can consist of multiple characters, as long as none of them is a digit nor the negative sign (e.g. ,  is as valid as just ,).

Any supported integer must eventually be printed after a finite amount of time.

Scoring

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

Leaderboard

var QUESTION_ID=93441,OVERRIDE_USER=41723;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Title: Print all integers

Body:
Python 2, 27 bytes

n=0
while 1:print~n,n,;n+=1

Prints -1 0 -2 1 -3 2 -4 3 ...


答:
Ruby, <s>26</s> <s>22</s> <s>19</s> 16 bytes

Prints numbers separated by newlines. -3 bytes from @manatwork. -3 bytes from @m-chrzan.

```<code>0.step{|n|p~n,n}
</code>```

Title: Print all integers

Body:
Write a program or function which will provably print all integers exactly once given infinite time and memory.

Possible outputs could be:

```<code>0, 1, -1, 2, -2, 3, -3, 4, -4, …

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9, 10, 11, …
</code>```

This is not a valid output, as this would never enumerate negative numbers:

<s>```0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …```</s>

The output must be in decimal, unless your language does not support decimal integer (in that case use the natural representation of integers your language uses).

Your program has to work up to the numbers with the biggest magnitude of the standard integer type of your language.

Each integer must be separated from the next using any separator (a space, a comma, a linebreak, etc.) that is not a digit nor the negative sign of your language.

The separator must not change at any point.

The separator can consist of multiple characters, as long as none of them is a digit nor the negative sign (e.g. ,  is as valid as just ,).

Any supported integer must eventually be printed after a finite amount of time.

Scoring

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

Leaderboard

var QUESTION_ID=93441,OVERRIDE_USER=41723;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Ruby, <s>26</s> <s>22</s> <s>19</s> 16 bytes

Prints numbers separated by newlines. -3 bytes from @manatwork. -3 bytes from @m-chrzan.

0.step{|n|p~n,n}


答:
05AB1E, <s>9</s> 6 bytes

Saved 3 bytes thanks to Adnan

```<code>[ND,±,
</code>```

Try it online!

Prints 0, -1, 1, -2, 2 ... separated by newlines.

Title: Print all integers

Body:
05AB1E, <s>9</s> 6 bytes

Saved 3 bytes thanks to Adnan

[ND,±,

Try it online!

Prints 0, -1, 1, -2, 2 ... separated by newlines.


答:
dc, 54 bytes

```<code>?dZsL0sN[dsNdZsL]su[dlN<u]sU[dZlL=UdZlL>ukz0<R]dsRxlNp
</code>```

Explanation:

?dZsL0sN                  # read input, initialize L (length) and N (number)
[dsNdZsL]su               # macro (function) 'u' updates the values of L and N
[dlN<u]sU                 # macro 'U' calls 'u' if N < curr_nr
[dZlL=U dZlL>ukz0<R]dsR   # macro 'R' is a loop that calls 'U' if L == curr_nr_len
                          #or 'u' if L > curr_nr_len
xlNp                      # the main: call 'R' and print N at the end
```

<p><strong>Run example:</strong> 'input.txt' contains all the test cases in the question's statement</p>

<pre class="lang-sh prettyprint-override"><code>while read list;do echo "$list -> "$(dc -f program.dc <<< $list);done < input.txt
</code>```

Output:

1 -> 1
9 -> 9
1729 -> 1729
1 1 -> 1
34 3 -> 3
38 39 -> 39
409 12 13 -> 13
11 11 11 1 -> 1
11 11 11 11 -> 11
78 99 620 1 -> 1
78 99 620 10 -> 99
78 99 620 100 -> 99
1 5 9 12 63 102 -> 9
3451 29820 2983 1223 1337 -> 3451
738 2383 281 938 212 1010 -> 938
```

Body:
dc, 54 bytes

?dZsL0sN[dsNdZsL]su[dlN<u]sU[dZlL=UdZlL>ukz0<R]dsRxlNp

Explanation:

?dZsL0sN                  # read input, initialize L (length) and N (number)
[dsNdZsL]su               # macro (function) 'u' updates the values of L and N
[dlN<u]sU                 # macro 'U' calls 'u' if N < curr_nr
[dZlL=U dZlL>ukz0<R]dsR   # macro 'R' is a loop that calls 'U' if L == curr_nr_len
                          #or 'u' if L > curr_nr_len
xlNp                      # the main: call 'R' and print N at the end

Run example: 'input.txt' contains all the test cases in the question's statement

while read list;do echo "$list -> "$(dc -f program.dc <<< $list);done < input.txt

Output:

1 -> 1
9 -> 9
1729 -> 1729
1 1 -> 1
34 3 -> 3
38 39 -> 39
409 12 13 -> 13
11 11 11 1 -> 1
11 11 11 11 -> 11
78 99 620 1 -> 1
78 99 620 10 -> 99
78 99 620 100 -> 99
1 5 9 12 63 102 -> 9
3451 29820 2983 1223 1337 -> 3451
738 2383 281 938 212 1010 -> 938


答:
Prolog (SWI), 33+3 = 36 bytes

```<code>A*B:-C is B-A,writeln(C),C*(1-B).
</code>```

Try it online!

Called as 0*0.

Prints 0, 1, -1, 2, -2 ... separated by newlines.

Saved 5 bytes thanks to SQB

Saved 16 bytes thanks to user3744156

Title: Print all integers

Body:
Prolog (SWI), 33+3 = 36 bytes

A*B:-C is B-A,writeln(C),C*(1-B).

Try it online!

Called as 0*0.

Prints 0, 1, -1, 2, -2 ... separated by newlines.

Saved 5 bytes thanks to SQB

Saved 16 bytes thanks to user3744156


答:
Haskell, 19 bytes

do n<-[1..];[1-n,n]
```

Produces the infinite list [0,1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,7,-7...

Haskell allows infinite lists natively. Printing such a list will prints its elements one a time forever.

Title: Print all integers

Body:
Haskell, 19 bytes

do n<-[1..];[1-n,n]

Produces the infinite list [0,1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,7,-7...

Haskell allows infinite lists natively. Printing such a list will prints its elements one a time forever.


答:
PHP , 86 Bytes

```<code><?$l=strlen($r=min($a=$_GET[a]));foreach($a as$v)if($v>$r&strlen($v)==$l)$r=$v;echo$r;
</code>```

Body:
PHP , 86 Bytes

<?$l=strlen($r=min($a=$_GET[a]));foreach($a as$v)if($v>$r&strlen($v)==$l)$r=$v;echo$r;


问:
print 1 to 100 without using recursion and conditions
can we print 1 to 100 without using any if conditions and loops in c&c++?

Conditon:
main point is you must not use recursion...and doesnt hardcode code in it
for e.g

print(1 2 3..etc);

答:
Python 3 (25)

```<code>print(list(range(1,101)))
</code>```

Body:
Python 3 (25)

print(list(range(1,101)))


答:
Java 7, <s>151</s> <s>134</s> <s>122</s> 118 bytes

```<code>import java.math.*;void c(){for(BigInteger i=BigInteger.ONE,y=i;;i=i.add(y))System.out.println(y.subtract(i)+"\n"+i);}
</code>```

12 bytes saved thanks to @flawr (and @xnor indirectly)

After rule change.. (<s>59</s> <s>56</s> 63 bytes)

```<code>void c(){for(int i=0;i>1<<31;)System.out.println(~--i+"\n"+i);}
</code>```

Since in Java 2147483647 + 1 = -2147483648, we can't simply do i++ and continue infinitely, since the challenge was to print all numbers once. With the above code with added range, it will instead print all integers from -2147483648 to 2147483647 once each, in the following sequence: 0, -1, 1, -2, 2, -3, 3, -4, ..., 2147483646, -2147483647, 2147483647, -2147483648. Thanks to @OlivierGrégoire for pointing out Java's behavior regarding MIN_VALUE-1/MAX_VALUE+1. Try it here.

Ungolfed & test code:

Try it here - resulting in runtime error

```<code>import java.math.*;
class M{
  static void c() {
    for(BigInteger i = BigInteger.ONE, y = i; ; i = i.add(y)){
      System.out.println(y.subtract(i) + "\n" + i);
    }
  }

  public static void main(String[] a){
    c();
  }
}
</code>```

Output:

```<code>0
1
-1
2
-2
3
-3
4
-4
5
-5
...
</code>```

Title: Print all integers

Body:
Java 7, <s>151</s> <s>134</s> <s>122</s> 118 bytes

import java.math.*;void c(){for(BigInteger i=BigInteger.ONE,y=i;;i=i.add(y))System.out.println(y.subtract(i)+"\n"+i);}

12 bytes saved thanks to @flawr (and @xnor indirectly)

After rule change.. (<s>59</s> <s>56</s> 63 bytes)

void c(){for(int i=0;i>1<<31;)System.out.println(~--i+"\n"+i);}

Since in Java 2147483647 + 1 = -2147483648, we can't simply do i++ and continue infinitely, since the challenge was to print all numbers once. With the above code with added range, it will instead print all integers from -2147483648 to 2147483647 once each, in the following sequence: 0, -1, 1, -2, 2, -3, 3, -4, ..., 2147483646, -2147483647, 2147483647, -2147483648. Thanks to @OlivierGrégoire for pointing out Java's behavior regarding MIN_VALUE-1/MAX_VALUE+1. Try it here.

Ungolfed & test code:

Try it here - resulting in runtime error

import java.math.*;
class M{
  static void c() {
    for(BigInteger i = BigInteger.ONE, y = i; ; i = i.add(y)){
      System.out.println(y.subtract(i) + "\n" + i);
    }
  }

  public static void main(String[] a){
    c();
  }
}

Output:

0
1
-1
2
-2
3
-3
4
-4
5
-5
...


答:
MATL, 9 bytes

```<code>0`t_DQtDT
</code>```

You can Try it online! (and let's hope that the process on the server actually terminates once you close your browser...)

Explanation:

```<code>0             % Push 0 on stack
 `       T    % Start infinite loop
  t_D         % Duplicate top element, negate and display (which consumes the duplicate)
     QtD      % Add 1 to top of stack, duplicate and display (which consumes the duplicate)
</code>```

Title: Print all integers

Body:
MATL, 9 bytes

0`t_DQtDT

You can Try it online! (and let's hope that the process on the server actually terminates once you close your browser...)

Explanation:

0             % Push 0 on stack
 `       T    % Start infinite loop
  t_D         % Duplicate top element, negate and display (which consumes the duplicate)
     QtD      % Add 1 to top of stack, duplicate and display (which consumes the duplicate)


答:
Java, <s>65</s> 54 bytes

```<code>i->{for(;;)System.out.print(i+++" "+(-i<i?-i+" ":""));
</code>```

Ungolfed test code

```<code>public static void main(String[] args) {
    Consumer<Integer> r = i -> {
        for (;;) {
            System.out.print(i++ + " " + (-i < i ? -i + " " : ""));
        }
    };

    r.accept(0);
}
</code>```

Title: Print all integers

Body:
Java, <s>65</s> 54 bytes

i->{for(;;)System.out.print(i+++" "+(-i<i?-i+" ":""));

Ungolfed test code

public static void main(String[] args) {
    Consumer<Integer> r = i -> {
        for (;;) {
            System.out.print(i++ + " " + (-i < i ? -i + " " : ""));
        }
    };

    r.accept(0);
}


答:
Batch, 56 bytes

```<code>@set n=0
:l
@echo %n%
@set/an+=1
@echo -%n%
@goto l
</code>```

Output:

```<code>0
-1
1
-2
2
-3
</code>```

etc. Works up to 2147483647; 58 bytes if you want (-)2147483648 in the output:

```<code>@set n=0
:l
@echo %n:-=%
@set/an-=1
@echo %n%
@goto l
</code>```

44 bytes if printing all supported positive integers, then all supported negative integers, then repeating endlessly, is acceptable:

```<code>@set n=0
:l
@echo %n%
@set/an+=1
@goto l
</code>```

Title: Print all integers

Body:
Batch, 56 bytes

@set n=0
:l
@echo %n%
@set/an+=1
@echo -%n%
@goto l

Output:

0
-1
1
-2
2
-3

etc. Works up to 2147483647; 58 bytes if you want (-)2147483648 in the output:

@set n=0
:l
@echo %n:-=%
@set/an-=1
@echo %n%
@goto l

44 bytes if printing all supported positive integers, then all supported negative integers, then repeating endlessly, is acceptable:

@set n=0
:l
@echo %n%
@set/an+=1
@goto l


答:
DC (GNU or OpenBSD flavour) - 16 bytes

This version is not shorter than the version below but should be able to run without the stack exploding in your PC. Nevertheless infinite large numbers will take up infinite amounts of memory... somewhen...

Because of the r command it needs GNU-DC or OpenBSD-DC.

```<code>0[rp1+45Pprdx]dx
</code>```

Test:

```<code>$ dc -e '0[rp1+45Pprdx]dx' | head
0
-1
1
-2
2
-3
3
-4
4
-5
</code>```

DC - 16 bytes

A little bit mean now. ;-)

This version is abusing the stack length as counter while letting the stack grow.

```<code>z[pz45Ppllx]dslx
</code>```

Test:

```<code>$ dc -e 'z[pz45Ppllx]dslx' | head
0
-1
1
-2
2
-3
3
-4
4
-5
</code>```

DC - 17 bytes

Without dirty tricks.

```<code>0[p1+45Ppllx]dslx
</code>```

Test:

```<code>$ dc -e '0[p1+45Ppllx]dslx' | head
0
-1
1
-2
2
-3
3
-4
4
-5
</code>```

Title: Print all integers

Body:
DC (GNU or OpenBSD flavour) - 16 bytes

This version is not shorter than the version below but should be able to run without the stack exploding in your PC. Nevertheless infinite large numbers will take up infinite amounts of memory... somewhen...

Because of the r command it needs GNU-DC or OpenBSD-DC.

0[rp1+45Pprdx]dx

Test:

$ dc -e '0[rp1+45Pprdx]dx' | head
0
-1
1
-2
2
-3
3
-4
4
-5

DC - 16 bytes

A little bit mean now. ;-)

This version is abusing the stack length as counter while letting the stack grow.

z[pz45Ppllx]dslx

Test:

$ dc -e 'z[pz45Ppllx]dslx' | head
0
-1
1
-2
2
-3
3
-4
4
-5

DC - 17 bytes

Without dirty tricks.

0[p1+45Ppllx]dslx

Test:

$ dc -e '0[p1+45Ppllx]dslx' | head
0
-1
1
-2
2
-3
3
-4
4
-5


答:
MATL, 8 bytes

```<code>0`@_@XDT
</code>```

This uses MATL's default data type, which is double,  so it works up to 2^53 in absolute value. The output is

```<code>0
-1
1
-2
2
···
</code>```

Try it online!

Explanation

```<code>0            % Push 0
  `     T    % Do...while true: infinite loop
   @_        % Push iteration index and negate
     @       % Push iteration index
      XD     % Display the whole stack
</code>```

Title: Print all integers

Body:
MATL, 8 bytes

0`@_@XDT

This uses MATL's default data type, which is double,  so it works up to 2^53 in absolute value. The output is

0
-1
1
-2
2
···

Try it online!

Explanation

0            % Push 0
  `     T    % Do...while true: infinite loop
   @_        % Push iteration index and negate
     @       % Push iteration index
      XD     % Display the whole stack


答:
Brainfuck, 6 bytes

This makes use of the cell wrapping and prints all possible values. In Brainfuck, the native integer representation is by byte value.

```<code>.+[.+]
</code>```

Try it online!

Title: Print all integers

Body:
Brainfuck, 6 bytes

This makes use of the cell wrapping and prints all possible values. In Brainfuck, the native integer representation is by byte value.

.+[.+]

Try it online!


答:
PHP, <s>28</s> 27 bytes

```<code>for(;1;)echo 1-++$i," $i ";
</code>```

As aross pointed out in the comments this only outputs PHP_INT_MIN (or indeed PHP_INT_MIN + 1) on a 32 bit implementation of php.

Old versions:

```<code>for(;++$i;)echo 1-$i," $i ";
</code>```

If a leading space is allowed then

```<code>for(;++$i;)echo" $i ",1-$i;
</code>```

Is 1 byte shorter. (same length as new version)

Title: Print all integers

Body:
PHP, <s>28</s> 27 bytes

for(;1;)echo 1-++$i," $i ";

As aross pointed out in the comments this only outputs PHP_INT_MIN (or indeed PHP_INT_MIN + 1) on a 32 bit implementation of php.

Old versions:

for(;++$i;)echo 1-$i," $i ";

If a leading space is allowed then

for(;++$i;)echo" $i ",1-$i;

Is 1 byte shorter. (same length as new version)


答:
ShadyAsFuck, 3 bytes

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

Explanation:

```<code>F     prints the current cell value (0) and increases it by 1
 V    starts a loop and prints the current value
  d   increases the current value and ends the loop
</code>```

This makes use of the cell wrapping and prints all possible values. In SAF, the native integer representation is by byte value.

Title: Print all integers

Body:
ShadyAsFuck, 3 bytes

FVd

Explanation:

F     prints the current cell value (0) and increases it by 1
 V    starts a loop and prints the current value
  d   increases the current value and ends the loop

This makes use of the cell wrapping and prints all possible values. In SAF, the native integer representation is by byte value.


答:
Caché ObjectScript, 28 bytes

```<code>w 0 f i=1:1 {w ",",i,",",-i}
</code>```

Title: Print all integers

Body:
Write a program or function which will provably print all integers exactly once given infinite time and memory.

Possible outputs could be:

```<code>0, 1, -1, 2, -2, 3, -3, 4, -4, …

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9, 10, 11, …
</code>```

This is not a valid output, as this would never enumerate negative numbers:

<s>```0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …```</s>

The output must be in decimal, unless your language does not support decimal integer (in that case use the natural representation of integers your language uses).

Your program has to work up to the numbers with the biggest magnitude of the standard integer type of your language.

Each integer must be separated from the next using any separator (a space, a comma, a linebreak, etc.) that is not a digit nor the negative sign of your language.

The separator must not change at any point.

The separator can consist of multiple characters, as long as none of them is a digit nor the negative sign (e.g. ,  is as valid as just ,).

Any supported integer must eventually be printed after a finite amount of time.

Scoring

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

Leaderboard

var QUESTION_ID=93441,OVERRIDE_USER=41723;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Caché ObjectScript, 28 bytes

w 0 f i=1:1 {w ",",i,",",-i}


答:
Scala (22)

```<code>1 to 100 foreach print
</code>```

Title: print 1 to 100 without using recursion and conditions

Body:
can we print 1 to 100 without using any if conditions and loops in c&c++?

Conditon:
main point is you must not use recursion...and doesnt hardcode code in it
for e.g

print(1 2 3..etc);

Body:
Scala (22)

1 to 100 foreach print


答:
JavaScript, <s>29</s> 26 bytes

Non-infinite version, 26 bytes

Saved 3 bytes thanks to ETHproductions

```<code>for(n=1;;)alert([1-n,n++])
</code>```

will display all integers between -9007199254740991 and 9007199254740992.

Infinite version (ES6), <s>114</s> 112 bytes

Saved 2 bytes thanks to ETHproductions

```<code>for(n=[-1];1;alert(n[a||n.unshift(1),0]?(x=n.join``)+' -'+x:0))for(i=n.length,a=0;i--;a=(n[i]+=1-a)>9?n[i]=0:1);
</code>```

will display all integers, given infinite time and memory.

Title: Print all integers

Body:
JavaScript, <s>29</s> 26 bytes

Non-infinite version, 26 bytes

Saved 3 bytes thanks to ETHproductions

for(n=1;;)alert([1-n,n++])

will display all integers between -9007199254740991 and 9007199254740992.

Infinite version (ES6), <s>114</s> 112 bytes

Saved 2 bytes thanks to ETHproductions

for(n=[-1];1;alert(n[a||n.unshift(1),0]?(x=n.join``)+' -'+x:0))for(i=n.length,a=0;i--;a=(n[i]+=1-a)>9?n[i]=0:1);

will display all integers, given infinite time and memory.


Title: Print all integers

Body:
C#, 83 bytes

void f(){for(decimal n=0;;n++){Console.Write(n+",");if(n>0)Console.Write(-n+",");}}

Ungolfed:

void f()
{
  for (decimal n=0;;n++)
  {
    Console.Write(n + ",");
    if (n > 0) Console.Write(-n + ",");
   }
}

Outputs:

0,1,-1,2,-2,3,-3,4,-4,5,-5,6,-6.......


答:
Scala, 27 bytes

```<code>def f(a:Boolean*)=a map(!_)
</code>```

Takes a bool array as varargs and maps each element to its inverse.

Title: Invert a boolean array

Body:
A nice simple one

Input

Given a boolean array (Or an acceptable alternative), you can assume the array will never be more than 32 elements long.

```<code>[false, false, true, false, false]
</code>```

Output

Invert every element of the array and output it.

```<code>[true, true, false, true, true]
</code>```

Rules

You can write a full program or just a function

Standard loopholes apply

Shortest code in bytes, per language, wins!

Test cases

```<code>Input:
[true, false]
Output:
[false, true]

Input: //Example of acceptable alternative
[0,1,1]
Output:
[1,0,0]
</code>```

Body:
Scala, 27 bytes

def f(a:Boolean*)=a map(!_)

Takes a bool array as varargs and maps each element to its inverse.


答:
C# <s>86</s> 66 bytes

New answer:

```<code>void b(){for(var i=0;;i++)Console.Write(i==0?","+i:","+i+",-"+i);}
</code>```

Clear:

```<code>void b()
{
    for(var i=0;;i++)
        Console.Write(i == 0 ? "," + i : "," + i + ",-" + i);
}
</code>```

Old answer (86 bytes):

```<code>void a(){Console.Write(String.Join(",",Enumerable.Range(int.MinValue,int.MaxValue)));}
</code>```

Ungolfed:

```<code>void a()
{
    Console.Write(String.Join(",", Enumerable.Range(int.MinValue, int.MaxValue)));
}
</code>```

Title: Print all integers

Body:
C# <s>86</s> 66 bytes

New answer:

void b(){for(var i=0;;i++)Console.Write(i==0?","+i:","+i+",-"+i);}

Clear:

void b()
{
    for(var i=0;;i++)
        Console.Write(i == 0 ? "," + i : "," + i + ",-" + i);
}

Old answer (86 bytes):

void a(){Console.Write(String.Join(",",Enumerable.Range(int.MinValue,int.MaxValue)));}

Ungolfed:

void a()
{
    Console.Write(String.Join(",", Enumerable.Range(int.MinValue, int.MaxValue)));
}


答:
Pyke, <s>7</s> 2 bytes

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

Try it here!

7 bytes

```<code>oDID_)r
</code>```

Try it here!

If printing +-0 is ok, oD_r

Title: Print all integers

Body:
Pyke, <s>7</s> 2 bytes

~I

Try it here!

7 bytes

oDID_)r

Try it here!

If printing +-0 is ok, oD_r


答:
Pyke, 7 bytes

```<code>.#_il)h
</code>```

Try it here!

Body:
Given a nonempty list of positive decimal integers, output the largest number from the set of numbers with the fewest digits.

The input list will not be in any particular order and may contain repeated values.

Examples:

```<code>[1] -> 1
[9] -> 9
[1729] -> 1729
[1, 1] -> 1
[34, 3] -> 3
[38, 39] -> 39
[409, 12, 13] -> 13
[11, 11, 11, 1] -> 1
[11, 11, 11, 11] -> 11
[78, 99, 620, 1] -> 1
[78, 99, 620, 10] -> 99
[78, 99, 620, 100] -> 99
[1, 5, 9, 12, 63, 102] -> 9
[3451, 29820, 2983, 1223, 1337] -> 3451
[738, 2383, 281, 938, 212, 1010] -> 938
</code>```

The shortest code in bytes wins.

Body:
Pyke, 7 bytes

.#_il)h

Try it here!


问:
StringgnirtSStringgnirtSStringgnirtS
Here is a relatively simple challenge for you.

Given a string of length N, output the string forwards, then backwards, then forwards, then backwards... etc. N times. For example, if your input was

```<code>Hello!
</code>```

You should output:

```<code>Hello!!olleHHello!!olleHHello!!olleH
</code>```

You may also optionally output one trailing newline.

Your submission may be either a full program or a function, and you may take input and output in any reasonable format. For example, you may take IO from STDIN/STDOUT, function arguments and return value, from a file, etc. You can safely assume that the input string will not be empty, and will only contain printable ASCII. You must output the new string on a single line. So, for example, if the output to the last example was

```<code>Hello!
!olleH
Hello!
!olleH
Hello!
!olleH
</code>```

This would not be a valid solution!

Here are some more test cases:

```<code>Input:
a
Output:
a

Input:
abcd
Output:
abcddcbaabcddcba

Input:
OK!
Output:
OK!!KOOK!

Input:
4815162342
Output:
4815162342243261518448151623422432615184481516234224326151844815162342243261518448151623422432615184

Input:
PPCG
Output:
PPCGGCPPPPCGGCPP

Input:
42
Output:
4224
</code>```

Leaderboards

Since this is a code-golf challenge, standard loopholes are banned, and the shortest answer in bytes wins! However, this is also a competition to have the shortest answer in any particular langauge. While it's unlikely that a Java answer will beat an answer in perl, or some golfing language, it's still very impressive to have the shortest Java answer. So, you can use this leaderboard to see both

The shortest answer out of all languages, and

The shortest answer in each individual language.

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 leaderboard snippet:

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

var QUESTION_ID=93261,OVERRIDE_USER=31716;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
Lua, 66 bytes

```<code>function f(s,i)j=i or 0return#s>j and s..f(s:reverse(),j+1)or''end
</code>```

Try it on ideone!

Title: StringgnirtSStringgnirtSStringgnirtS

Body:
Lua, 66 bytes

function f(s,i)j=i or 0return#s>j and s..f(s:reverse(),j+1)or''end

Try it on ideone!


答:
R, <s>25</s> 24 bytes

Golfed one byte thanks to @JDL.

```<code>repeat cat(-F,F<-F+1,'')
</code>```

Try it online!

Example output:

```<code>0 1 -1 2 -2 3 -3 4 -4 5 -5 6 -6 7 -7 8 -8 9 -9 10
</code>```

Title: Print all integers

Body:
R, <s>25</s> 24 bytes

Golfed one byte thanks to @JDL.

repeat cat(-F,F<-F+1,'')

Try it online!

Example output:

0 1 -1 2 -2 3 -3 4 -4 5 -5 6 -6 7 -7 8 -8 9 -9 10


答:
GNU sed, 189 + 2(rn flags) = 191 bytes

This is most likely the longest solution, since sed has no integer type or arithmetic operations. As such, I had to emulate an arbitrary size increment operator using regular expressions only.

s/^/0/p
:
:i;s/9(@*)$/@\1/;ti
s/8(@*)$/9\1/
s/7(@*)$/8\1/
s/6(@*)$/7\1/
s/5(@*)$/6\1/
s/4(@*)$/5\1/
s/3(@*)$/4\1/
s/2(@*)$/3\1/
s/1(@*)$/2\1/
s/0(@*)$/1\1/
s/^@+/1&/;y/@/0/
s/^/-/p;s/-//p
t
```

<p><strong>Run:</strong></p>

<pre class="lang-sh prettyprint-override"><code>echo | sed -rnf all_integers.sed
</code>```

Output:

0
-1
1
-2
2
-3
3
etc.
```

Title: Print all integers

Body:
GNU sed, 189 + 2(rn flags) = 191 bytes

This is most likely the longest solution, since sed has no integer type or arithmetic operations. As such, I had to emulate an arbitrary size increment operator using regular expressions only.

s/^/0/p
:
:i;s/9(@*)$/@\1/;ti
s/8(@*)$/9\1/
s/7(@*)$/8\1/
s/6(@*)$/7\1/
s/5(@*)$/6\1/
s/4(@*)$/5\1/
s/3(@*)$/4\1/
s/2(@*)$/3\1/
s/1(@*)$/2\1/
s/0(@*)$/1\1/
s/^@+/1&/;y/@/0/
s/^/-/p;s/-//p
t

Run:

echo | sed -rnf all_integers.sed

Output:

0
-1
1
-2
2
-3
3
etc.


问:
Draw A Sierpinski Triangle
The Sierpinsky Triangle is a fractal created by taking a triangle, decreasing the height and width by 1/2, creating 3 copies of the resulting triangle, and place them such each triangle touches the other two on a corner.  This process is repeated over and over again with the resulting triangles to produce the Sierpinski triangle, as illustrated below.

Write a program to generate a Sierpinski triangle.  You can use any method you want to generate the pattern, either by drawing the actual triangles, or by using a random algorithm to generate the picture.  You can draw in pixels, ascii art, or whatever you want, so long as the output looks similar to the last picture shown above.  Fewest characters wins.

答:
APL, <s>37</s> 32 (<s>28</s> 23)

Upright triangle (<s>37</s> 32-char)

```<code>({((-1⌷⍴⍵)⌽⍵,∊⍵)⍪⍵,⍵}⍣⎕)1 2⍴'/\'
</code>```

Explanation

1 2⍴'/\': Create a 1×2 character matrix /\

{((-1⌷⍴⍵)⌽⍵,∊⍵)⍪⍵,⍵}: A function that pad the right argument on both sides with blanks to create a matrix double as wide, then laminates the right argument itself doubled onto the bottom.

E.g. /\ would become

``` /\
/\/\```

⍣⎕: Recur the function (user input) times.

Example output

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

Skewed Triangle (<s>28</s> 23-char)

```<code>({(⍵,∊⍵)⍪⍵,⍵}⍣⎕)1 1⍴'○'
</code>```

Explaination

1 1⍴'○': Create a 1×1 character matrix ○

{(⍵,∊⍵)⍪⍵,⍵}: A function that pad the right argument on the right with blanks to create a matrix double as wide, then laminates the right argument itself doubled onto the bottom.

E.g. ○ would become

```○
○○```

⍣⎕: Recur the function (user input) times.

Example output

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

Title: Draw A Sierpinski Triangle

Body:
APL, <s>37</s> 32 (<s>28</s> 23)

Upright triangle (<s>37</s> 32-char)

({((-1⌷⍴⍵)⌽⍵,∊⍵)⍪⍵,⍵}⍣⎕)1 2⍴'/\'

Explanation

1 2⍴'/\': Create a 1×2 character matrix /\

{((-1⌷⍴⍵)⌽⍵,∊⍵)⍪⍵,⍵}: A function that pad the right argument on both sides with blanks to create a matrix double as wide, then laminates the right argument itself doubled onto the bottom.

E.g. /\ would become

 /\
/\/\

⍣⎕: Recur the function (user input) times.

Example output

               /\
              /\/\
             /\  /\
            /\/\/\/\
           /\      /\
          /\/\    /\/\
         /\  /\  /\  /\
        /\/\/\/\/\/\/\/\
       /\              /\
      /\/\            /\/\
     /\  /\          /\  /\
    /\/\/\/\        /\/\/\/\
   /\      /\      /\      /\
  /\/\    /\/\    /\/\    /\/\
 /\  /\  /\  /\  /\  /\  /\  /\
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Skewed Triangle (<s>28</s> 23-char)

({(⍵,∊⍵)⍪⍵,⍵}⍣⎕)1 1⍴'○'

Explaination

1 1⍴'○': Create a 1×1 character matrix ○

{(⍵,∊⍵)⍪⍵,⍵}: A function that pad the right argument on the right with blanks to create a matrix double as wide, then laminates the right argument itself doubled onto the bottom.

E.g. ○ would become

○
○○

⍣⎕: Recur the function (user input) times.

Example output

○
○○
○ ○
○○○○
○   ○
○○  ○○
○ ○ ○ ○
○○○○○○○○
○       ○
○○      ○○
○ ○     ○ ○
○○○○    ○○○○
○   ○   ○   ○
○○  ○○  ○○  ○○
○ ○ ○ ○ ○ ○ ○ ○
○○○○○○○○○○○○○○○○


答:
><>, <s>19</s> 15 bytes

```<code>1::1$-naonao1+!
</code>```

This prints the following:

```<code>0
1
-1
2
-2
3
-3
</code>```

... and so on. The separator is a newline.

Re-written after reading @xnor's answer to use a version of that algorithm. Starting at n=1, the program prints 1-n and n, each followed by a newline, before incrementing n. After overflowing the maximum value the program will end with an error of something smells fishy.... Exactly when this will happen depends on the interpreter implementation.

Previous version:

```<code>0:nao0$-:10{0(?$~+!
</code>```

Starting at 0, the program loops indefinitely. On each loop, the current value is printed along with a newline. It is then negated, and incremented if positive.

Title: Print all integers

Body:
><>, <s>19</s> 15 bytes

1::1$-naonao1+!

This prints the following:

0
1
-1
2
-2
3
-3

... and so on. The separator is a newline.

Re-written after reading @xnor's answer to use a version of that algorithm. Starting at n=1, the program prints 1-n and n, each followed by a newline, before incrementing n. After overflowing the maximum value the program will end with an error of something smells fishy.... Exactly when this will happen depends on the interpreter implementation.

Previous version:

0:nao0$-:10{0(?$~+!

Starting at 0, the program loops indefinitely. On each loop, the current value is printed along with a newline. It is then negated, and incremented if positive.


答:
MATL, <s>13</s> <s>12</s> 8 bytes

Pushes all elements, combines in the end.

```<code>td"tP]&h

td"  ]     %For loop over string length - 1 due to diff
   tP      %Push copy of string, reverse
      &h   %Concatenate entire stack horizontally

</code>```

Try it online!

Old versions:

Completely different approach, based on fprintf:

```<code>t"t1$0#YDP]x

t"        ]   % For loop over string
  t           % Duplicate string for printing:
   1$0#YD     % `fprintf` with 1 input, 0 output (i.e., to screen).
         P    % Reverse
           x  % Empty stack to prevent implicit output
</code>```

Version based on reversing a template string

```<code>ttd"wPtbYc]Dx

t                 %Duplicate input, to create 'accumulator' string
                  % (alongside the input string which will serve as 'template'
 td               %Duplicate input, diff to get an stringof size input-1
   "       ]      %For loop over size n-1 string (consumes diff'd string)
     wP           %Get 'template' string on top of stack, and reverse
       tb         %Duplicate template string, and switch with 'accumulator' string
         Yc       %Concatenate template string with accumulator.
            Dx   %Display top element, delete template string to prevent implicit disp
</code>```

Title: StringgnirtSStringgnirtSStringgnirtS

Body:
Here is a relatively simple challenge for you.

Given a string of length N, output the string forwards, then backwards, then forwards, then backwards... etc. N times. For example, if your input was

```<code>Hello!
</code>```

You should output:

```<code>Hello!!olleHHello!!olleHHello!!olleH
</code>```

You may also optionally output one trailing newline.

Your submission may be either a full program or a function, and you may take input and output in any reasonable format. For example, you may take IO from STDIN/STDOUT, function arguments and return value, from a file, etc. You can safely assume that the input string will not be empty, and will only contain printable ASCII. You must output the new string on a single line. So, for example, if the output to the last example was

```<code>Hello!
!olleH
Hello!
!olleH
Hello!
!olleH
</code>```

This would not be a valid solution!

Here are some more test cases:

```<code>Input:
a
Output:
a

Input:
abcd
Output:
abcddcbaabcddcba

Input:
OK!
Output:
OK!!KOOK!

Input:
4815162342
Output:
4815162342243261518448151623422432615184481516234224326151844815162342243261518448151623422432615184

Input:
PPCG
Output:
PPCGGCPPPPCGGCPP

Input:
42
Output:
4224
</code>```

Leaderboards

Since this is a code-golf challenge, standard loopholes are banned, and the shortest answer in bytes wins! However, this is also a competition to have the shortest answer in any particular langauge. While it's unlikely that a Java answer will beat an answer in perl, or some golfing language, it's still very impressive to have the shortest Java answer. So, you can use this leaderboard to see both

The shortest answer out of all languages, and

The shortest answer in each individual language.

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 leaderboard snippet:

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

var QUESTION_ID=93261,OVERRIDE_USER=31716;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
MATL, <s>13</s> <s>12</s> 8 bytes

Pushes all elements, combines in the end.

td"tP]&h

td"  ]     %For loop over string length - 1 due to diff
   tP      %Push copy of string, reverse
      &h   %Concatenate entire stack horizontally

Try it online!

Old versions:

Completely different approach, based on fprintf:

t"t1$0#YDP]x

t"        ]   % For loop over string
  t           % Duplicate string for printing:
   1$0#YD     % `fprintf` with 1 input, 0 output (i.e., to screen).
         P    % Reverse
           x  % Empty stack to prevent implicit output

Version based on reversing a template string

ttd"wPtbYc]Dx

t                 %Duplicate input, to create 'accumulator' string
                  % (alongside the input string which will serve as 'template'
 td               %Duplicate input, diff to get an stringof size input-1
   "       ]      %For loop over size n-1 string (consumes diff'd string)
     wP           %Get 'template' string on top of stack, and reverse
       tb         %Duplicate template string, and switch with 'accumulator' string
         Yc       %Concatenate template string with accumulator.
            Dx   %Display top element, delete template string to prevent implicit disp


问:
Is it a Bumpy Word?
(inspired by this challenge over on Puzzling -- SPOILERS for that puzzle are below, so stop reading here if you want to solve that puzzle on your own!)

If a letter in a word occurs alphabetically later than the previous letter in the word, we call that a rise between the two letters. Otherwise, including if it's the same letter, it's called a fall.

For example, the word ACE has two rises (A to C and C to E) and no falls, while THE has two falls (T to H and H to E) and no rises.

We call a word Bumpy if the sequence of rises and falls alternates. For example, BUMP goes rise (B to U), fall (U to M), rise (M to P). Note that the first sequence need not be a rise -- BALD goes fall-rise-fall and is also Bumpy.

The challenge

Given a word, output whether or not it's Bumpy.

Input

A word (not necessarily a dictionary word) consisting of ASCII alphabet ([A-Z] or [a-z]) letters only, in any suitable format.

Your choice if the input is all uppercase or all lowercase, but it must be consistent.

The word will be at least 3 characters in length.

Output

A truthy/falsey value for whether the input word is Bumpy (truthy) or not Bumpy (falsey).

The Rules

Either a full program or a function are acceptable.

Standard loopholes are forbidden.

This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Examples

Truthy:

```<code>ABA
ABB
BAB
BUMP
BALD
BALDY
UPWARD
EXAMINATION
AZBYCXDWEVFUGTHSIRJQKPLOMN
</code>```

Falsey:

```<code>AAA
BBA
ACE
THE
BUMPY
BALDING
ABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

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 leaderboard snippet:

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

var QUESTION_ID=93005,OVERRIDE_USER=42963;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
PHP, 100 bytes

```<code>for($s=$argv[1];$i<strlen($s)-1;$i++)$s[$i]=$s[$i+1]>$s[$i]?r:f;echo str_replace([rr,ff],'',$s)==$s;
</code>```

Replaces every char of the string (except the last one obviously) with an r for rise or an f for fall and then checks whether rr or ff occur in the string. To avoid that the last remaining character interfers with that, input must be all uppercase.

I'm very unsatisfied with the loop, for example I have a feeling that there must be a way to combine the $i++ into one of the several $is used in the loop, but I failed to find that way. Maybe someone else sees it.

(That's also why I posted my code, despite it being 20 (!) bytes longer than Titus' nice solution.)

Title: Is it a Bumpy Word?

Body:
PHP, 100 bytes

for($s=$argv[1];$i<strlen($s)-1;$i++)$s[$i]=$s[$i+1]>$s[$i]?r:f;echo str_replace([rr,ff],'',$s)==$s;

Replaces every char of the string (except the last one obviously) with an r for rise or an f for fall and then checks whether rr or ff occur in the string. To avoid that the last remaining character interfers with that, input must be all uppercase.

I'm very unsatisfied with the loop, for example I have a feeling that there must be a way to combine the $i++ into one of the several $is used in the loop, but I failed to find that way. Maybe someone else sees it.

(That's also why I posted my code, despite it being 20 (!) bytes longer than Titus' nice solution.)


问:
Print the alphabet without using each vowel
Inspiration: in 1939, a man named Ernest Vincent Wright wrote a novel called Gadsby without using the letter 'e'.

Your task is to write a set of (up to 5) programs in any language (which has a text-based syntax*) to output all 26 letters of the alphabet in order.  However for each vowel aeiou, at least one of the programs must not include any occurrence of the vowel.

So there must be

a program that does not use 'a' or 'A' anywhere in the syntax of the program.

a program that does not use 'e' or 'E' anywhere in the syntax of the program.

a program that does not use 'i'  or 'I' anywhere in the syntax of the program.

a program that does not use 'o' or 'O' anywhere in the syntax of the program.

a program that does not use 'u' or 'U' anywhere in the syntax of the program.

All of them must output abcdefghijklmnopqrstuvwxyz.

The winner shall be the solution where the length of all programs is the shortest.

* since the constraint wouldn't be much of a challenge in Piet or Whitespace

答:
Jelly, 7 chars

```<code>”Ø;97ỌV
</code>```

Try it online!

Seems like this should (not (non-competing)) be accepted instead of GolfScript.

Note:

Ø and Ọ are not O, so this is valid. Here is how I built it:

My initial program (2 bytes) was:

```<code>Øa
</code>```

But, since it contained an a, I had to change it.

This could have been a valid 6-char program if uppercase output was allowed:

```<code>65r90Ọ
</code>```

Body:
Jelly, 7 chars

”Ø;97ỌV

Try it online!

Seems like this should (not (non-competing)) be accepted instead of GolfScript.

Note:

Ø and Ọ are not O, so this is valid. Here is how I built it:

My initial program (2 bytes) was:

Øa

But, since it contained an a, I had to change it.

This could have been a valid 6-char program if uppercase output was allowed:

65r90Ọ


答:
Julia, 42 bytes

```<code>h(s,l=1)=l==endof(s)?s:s*h(reverse(s),l+1)
</code>```

Recursive function with counter variable l. If it is equal to the length of the string s, simply return it, otherwise concatenate (s*...) it with h(reverse(s),...) while incrementing the counter l+1.

Title: StringgnirtSStringgnirtSStringgnirtS

Body:
Julia, 42 bytes

h(s,l=1)=l==endof(s)?s:s*h(reverse(s),l+1)

Recursive function with counter variable l. If it is equal to the length of the string s, simply return it, otherwise concatenate (s*...) it with h(reverse(s),...) while incrementing the counter l+1.


问:
Counterfeit Coins on a Pointer Scale
You sell gold coins. Each gold coin you sell is supposed to be 1 ounce. However, you find out that one of your coin suppliers is cheating you. By alloying the gold material with something else, their coins weigh only 0.9 ounces. With a help of a pointer scale (one that shows the exact weight of a quantity of matter set on it), you want to determine which of your coin suppliers is selling you the counterfeit coins.

Apparently, you are not the only one to have this problem - lots of gold sellers buy coins from this supplier, and the supplier knows that it is being dodgy and is changing their branding accordingly. All of these sellers have the same problem - 1 ounce coins that end up being 0.9 ounces from this supplier - and need to solve it, fast! How can you determine, out of n suppliers, which one is the cheating supplier with the minimum number of weighings on the pointer scale?

Your task is to write a program function that can solve this problem automatically for n suppliers. It's input includes:

an integer number of suppliers, n,

an oracle function that represents weighing a set of coins on the balance scale

It must take this information, calling this function a minimum number of times and returning, as output, the index number of the cheating supplier.

The oracle function has the following specifications:

It takes as input an int->int mapping (as an array or dictionary, whichever your language prefers) mapping each supplier index (from 0 to n-1) to a number of gold coins that you want to try weighing on the scale.

The returned output is the total weight, in ounces, of the coins put on the scale.

The function is in whatever format your language prefers for passing procedures as data. For instance, functional languages will pass lambdas, C will take a function pointer, Java 7 and earlier will take a functional interface. Languages that support none of these, but do support string execution, will take these as strings.

In those cases when the oracle can be stringified or otherwise inspected as data, you may assume that it is sufficiently obfuscated such that you cannot tell which supplier is cheating without executing it.

This is also code-golf: among the solutions that call the function the minimum number of times, the smallest solution in bytes is the winner!

NOTE: If your language does not support functions at all, but does support string execution, write your program as a standalone program - assume that the number of suppliers, followed by the oracle, will be passed into standard input. If your language does not support string execution, assume that a file path to a binary oracle will be provided instead.

答:
Mathematica, 23 Byte

```<code>5#(#+1)-1-10#2@Range@#&
</code>```

Same approach as xnor. In Mathematica Range starts with 1, which is equivalent to using n+1 coins from the nth supplier. Hence, the formula for the fair sum is n(n+1)/2 and we have to subtract 1 from the result to restore zero-based indexing.

```<code>5#(#+1)-1-10#2@Range@#&[5,oracle]
</code>```

149 - 10 oracle[{1, 2, 3, 4, 5}]

Title: Counterfeit Coins on a Pointer Scale

Body:
Mathematica, 23 Byte

5#(#+1)-1-10#2@Range@#&

Same approach as xnor. In Mathematica Range starts with 1, which is equivalent to using n+1 coins from the nth supplier. Hence, the formula for the fair sum is n(n+1)/2 and we have to subtract 1 from the result to restore zero-based indexing.

5#(#+1)-1-10#2@Range@#&[5,oracle]

149 - 10 oracle[{1, 2, 3, 4, 5}]


问:
English to Alien translator

Briefing

Aliens have settled on earth and strangely enough, their alphabet is the exact same as ours. Their language is also very similar to ours with some very distinct and easy to compute differences.

Challenge

Take a string and output the alien's language equivalent. The translation works as such:

Swap all the vowels in the word with the corresponding:

```<code>  Vowel |   With
--------+--------
   a    |   obo
   e    |   unu
   i    |   ini
   o    |   api
   u    |   iki
</code>```

You may also write another translator to translate Alien->English, this is optional however.

Examples

```<code>Input: Shaun
Output: Shoboikin

Input: Java
Output: Jobovobo

Input: Hello, World!
Output: Hunullapi, Wapirld!
</code>```

If the vowel is capitalized then you capitalize the first letter..

```<code>Input: Alan
Output: Obolobon

Input: Australia
Output: Oboikistroboliniobo
</code>```

Rules

Standard loopholes apply

Must work for text that contains new lines

You can either write a function, lambda, or full program

Capingrobotikilobotiniapins apin wrinitining thunu runuvunursunu trobonslobotapir!

答:
05AB1E, <s>28</s> <s>27</s> 20 bytes

```<code>žÀ.•₅%~≠#ùÛãú•3ôD™«‡
</code>```

Try it online!

Unuxplobonobotiniapin

```<code>žÀ                    # the string "aeiouAEIOU"
  .•₅%~≠#ùÛãú•        # the string "obounuiniapiiki"
              3ô      # split in pieces of 3
                D™«   # concatenate with a title-case copy
                   ‡  # transliterate
</code>```

Title: English to Alien translator

Body:
05AB1E, <s>28</s> <s>27</s> 20 bytes

žÀ.•₅%~≠#ùÛãú•3ôD™«‡

Try it online!

Unuxplobonobotiniapin

žÀ                    # the string "aeiouAEIOU"
  .•₅%~≠#ùÛãú•        # the string "obounuiniapiiki"
              3ô      # split in pieces of 3
                D™«   # concatenate with a title-case copy
                   ‡  # transliterate


答:
C#, 119 bytes

```<code>int L(int[]n){var g=n.GroupBy(o=>(o+"").Length);return g.Where(o=>o.Key==g.Min(k=>k.Key)).OrderBy(o=>o).First().Max();}
</code>```

Ungolfed:

```<code>public int L(int[]n)
{
  var g = n.GroupBy(o => (o+"").Length);
  return g.Where(o => o.Key == g.Min(k => k.Key)).OrderBy(o => o).First().Max();
}
</code>```

Magical Linq...

Usage:

```<code>var a = new LargestNumberFewestDigits();
Console.Write(a.L(new int[] { 738, 2383, 281, 938, 212, 1010 }));
</code>```

Output:

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

Body:
C#, 119 bytes

int L(int[]n){var g=n.GroupBy(o=>(o+"").Length);return g.Where(o=>o.Key==g.Min(k=>k.Key)).OrderBy(o=>o).First().Max();}

Ungolfed:

public int L(int[]n)
{
  var g = n.GroupBy(o => (o+"").Length);
  return g.Where(o => o.Key == g.Min(k => k.Key)).OrderBy(o => o).First().Max();
}

Magical Linq...

Usage:

var a = new LargestNumberFewestDigits();
Console.Write(a.L(new int[] { 738, 2383, 281, 938, 212, 1010 }));

Output:

938


答:
Retina, <s>21</s> 19 bytes

```<code>{M*`.
^
1
*`.+
-$.&
</code>```

Try it online! (Takes about a minute before you see anything.)

Title: Print all integers

Body:
Write a program or function which will provably print all integers exactly once given infinite time and memory.

Possible outputs could be:

```<code>0, 1, -1, 2, -2, 3, -3, 4, -4, …

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9, 10, 11, …
</code>```

This is not a valid output, as this would never enumerate negative numbers:

<s>```0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …```</s>

The output must be in decimal, unless your language does not support decimal integer (in that case use the natural representation of integers your language uses).

Your program has to work up to the numbers with the biggest magnitude of the standard integer type of your language.

Each integer must be separated from the next using any separator (a space, a comma, a linebreak, etc.) that is not a digit nor the negative sign of your language.

The separator must not change at any point.

The separator can consist of multiple characters, as long as none of them is a digit nor the negative sign (e.g. ,  is as valid as just ,).

Any supported integer must eventually be printed after a finite amount of time.

Scoring

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

Leaderboard

var QUESTION_ID=93441,OVERRIDE_USER=41723;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Retina, <s>21</s> 19 bytes

{M*`.
^
1
*`.+
-$.&

Try it online! (Takes about a minute before you see anything.)


答:
C#, 19 bytes

as an annonymous function, takes a bool[] and returns an IEnumerable

```<code>b=>b.Select(x=>!x);
</code>```

or in 36 bytes with

```<code>dynamic f(bool[]b)=>b.Select(x=>!x);
</code>```

Title: Invert a boolean array

Body:
A nice simple one

Input

Given a boolean array (Or an acceptable alternative), you can assume the array will never be more than 32 elements long.

```<code>[false, false, true, false, false]
</code>```

Output

Invert every element of the array and output it.

```<code>[true, true, false, true, true]
</code>```

Rules

You can write a full program or just a function

Standard loopholes apply

Shortest code in bytes, per language, wins!

Test cases

```<code>Input:
[true, false]
Output:
[false, true]

Input: //Example of acceptable alternative
[0,1,1]
Output:
[1,0,0]
</code>```

Body:
C#, 19 bytes

as an annonymous function, takes a bool[] and returns an IEnumerable

b=>b.Select(x=>!x);

or in 36 bytes with

dynamic f(bool[]b)=>b.Select(x=>!x);


答:
Octave, 30 bytes

```<code>x=0;while 1;disp([x++;-x]);end
</code>```

Explanation:

```<code>x=1;       % Initialize x to 1
while 1;   % Infinite loop since 1 == true
[x++,-x]   % x, then post increment and show the negative version
disp(___)  % display it
end
</code>```

Prints the following sequence, starting from 0:

```<code>   0
  -1
   1
  -2
   2
  -3
   3
   .
   .
</code>```

Title: Print all integers

Body:
Octave, 30 bytes

x=0;while 1;disp([x++;-x]);end

Explanation:

x=1;       % Initialize x to 1
while 1;   % Infinite loop since 1 == true
[x++,-x]   % x, then post increment and show the negative version
disp(___)  % display it
end

Prints the following sequence, starting from 0:

   0
  -1
   1
  -2
   2
  -3
   3
   .
   .


答:
PHP , 91 Bytes

```<code><?=strtr($argv[1],[A=>Obo,E=>Unu,I=>Ini,O=>Api,U=>Iki,a=>obo,e=>unu,i=>ini,o=>api,u=>iki]);
</code>```

Title: English to Alien translator

Body:
Briefing

Aliens have settled on earth and strangely enough, their alphabet is the exact same as ours. Their language is also very similar to ours with some very distinct and easy to compute differences.

Challenge

Take a string and output the alien's language equivalent. The translation works as such:

Swap all the vowels in the word with the corresponding:

```<code>  Vowel |   With
--------+--------
   a    |   obo
   e    |   unu
   i    |   ini
   o    |   api
   u    |   iki
</code>```

You may also write another translator to translate Alien->English, this is optional however.

Examples

```<code>Input: Shaun
Output: Shoboikin

Input: Java
Output: Jobovobo

Input: Hello, World!
Output: Hunullapi, Wapirld!
</code>```

If the vowel is capitalized then you capitalize the first letter..

```<code>Input: Alan
Output: Obolobon

Input: Australia
Output: Oboikistroboliniobo
</code>```

Rules

Standard loopholes apply

Must work for text that contains new lines

You can either write a function, lambda, or full program

Capingrobotikilobotiniapins apin wrinitining thunu runuvunursunu trobonslobotapir!

Body:
PHP , 91 Bytes

<?=strtr($argv[1],[A=>Obo,E=>Unu,I=>Ini,O=>Api,U=>Iki,a=>obo,e=>unu,i=>ini,o=>api,u=>iki]);


答:
Retina, 60 bytes

Byte count assumes ISO 8859-1 encoding.

```<code>[A-Z]
»$&
T`L`l
i
ini
u
iki
e
unu
a
·b·
o
api
·
o
T`»l`_L`».
</code>```

Try it online!

Title: English to Alien translator

Body:
Retina, 60 bytes

Byte count assumes ISO 8859-1 encoding.

[A-Z]
»$&
T`L`l
i
ini
u
iki
e
unu
a
·b·
o
api
·
o
T`»l`_L`».

Try it online!


答:
Batch, 215 bytes

```<code>@echo off
set/pt=
set s=
:l
if "%t%"=="" echo(%s%&exit/b
set c=%t:~0,1%
for %%a in (obo.a unu.e ini.i api.o iki.u Obo.A Unu.E Ini.I Api.O Iki.U)do if .%c%==%%~xa set c=%%~na
set s=%s%%c%
set t=%t:~1%
goto l
</code>```

Takes input on STDIN. Processing character-by-character has the convenience of being case-sensitive.

Title: English to Alien translator

Body:
Batch, 215 bytes

@echo off
set/pt=
set s=
:l
if "%t%"=="" echo(%s%&exit/b
set c=%t:~0,1%
for %%a in (obo.a unu.e ini.i api.o iki.u Obo.A Unu.E Ini.I Api.O Iki.U)do if .%c%==%%~xa set c=%%~na
set s=%s%%c%
set t=%t:~1%
goto l

Takes input on STDIN. Processing character-by-character has the convenience of being case-sensitive.


答:
MATLAB 64 bytes

As a start, with nothing clever:

```<code>fprintf('0');a=int64(1);while(1) fprintf(' %d',[a -a]);a=a+1;end
</code>```

Enter at the console, generates 0 1 -1 2 -2...

There must be a better way than this! Come on, folks...

Title: Print all integers

Body:
MATLAB 64 bytes

As a start, with nothing clever:

fprintf('0');a=int64(1);while(1) fprintf(' %d',[a -a]);a=a+1;end

Enter at the console, generates 0 1 -1 2 -2...

There must be a better way than this! Come on, folks...


问:
Convert YYYYMM to MMMYY
Basing on this SO question.

Challenge is rather simple: given a date period in the format YYYYMM output it in the format MMMYY.

Rules:

The input will be a number or a string exactly 6 characters long, consisting only of digits.

Last two digits will be between 01 and 12.

Output must be in the form MMMYY, where MMM represents uppercase three-letter code for the month (below) and YY represents two last digits of the YYYY part of the input.

List of months with corresponding code:

```<code>MM    MMM
01    JAN
02    FEB
03    MAR
04    APR
05    MAY
06    JUN
07    JUL
08    AUG
09    SEP
10    OCT
11    NOV
12    DEC
</code>```

Examples:

```<code>Input     Output
201604    APR16
200001    JAN00
000112    DEC01
123405    MAY34
</code>```

答:
Java, 142 bytes

```<code>s->(new String[]{"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"})[Integer.decode(s.substring(4))-1]+s.substring(2,4);
</code>```

Title: Convert YYYYMM to MMMYY

Body:
Java, 142 bytes

s->(new String[]{"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"})[Integer.decode(s.substring(4))-1]+s.substring(2,4);


答:
J, 25 bytes

```<code>([:$:1:`-`(1+-)@.*[echo)0
</code>```

Works on the online site, but I can't verify it on computer yet. Prints numbers like:

```<code>0
1
_1
2
_2
3
_3
4
</code>```

etc.

Title: Print all integers

Body:
J, 25 bytes

([:$:1:`-`(1+-)@.*[echo)0

Works on the online site, but I can't verify it on computer yet. Prints numbers like:

0
1
_1
2
_2
3
_3
4

etc.


答:
Powershell, <s>20</s> <s>19</s> 18 bytes

Improved by stealing shamelessly from TimmyD's answer

```<code>0;for(){-++$i;$i}
</code>```

Output:

```<code>0
-1
1
-2
2
-3
3
-4
4
</code>```

Old version:

```<code>for(){-$i;$i++;$i}
</code>```

Not sure why tbh, but -undeclared variable (or -$null) is evaluted as 0, which saved us 2 bytes in this version...

Title: Print all integers

Body:
Powershell, <s>20</s> <s>19</s> 18 bytes

Improved by stealing shamelessly from TimmyD's answer

0;for(){-++$i;$i}

Output:

0
-1
1
-2
2
-3
3
-4
4

Old version:

for(){-$i;$i++;$i}

Not sure why tbh, but -undeclared variable (or -$null) is evaluted as 0, which saved us 2 bytes in this version...