答:
Sesos, 11 bytes

With many thanks to Leaky Nun for his help, and credit to his Brainf*ck answer, which inspired this one. Golfing suggestions welcome. Try It Online!

```<code>0000000: A8 24 BE EC CB 82 06 BD A7 EC 0E    .$.........
</code>```

How it works

The binary file above has been generated by assembling the following SASM code.

```<code>add 42,fwd 1,add 10,fwd 1,add 10  # puts 42, 10, 10 in the register
jmp,sub 1,rwd 1                   # starts the first loop
jmp,sub 1,rwd 1,put,fwd 1,jnz     # second loop prints 42 or "*"
add 10,put,fwd 1                  # resets first loop, prints 10 or "\n"
                                  # first loop ends implicitly
</code>```

Title: Print a 10 by 10 grid of asterisks

Body:
Sesos, 11 bytes

With many thanks to Leaky Nun for his help, and credit to his Brainf*ck answer, which inspired this one. Golfing suggestions welcome. Try It Online!

0000000: A8 24 BE EC CB 82 06 BD A7 EC 0E    .$.........

How it works

The binary file above has been generated by assembling the following SASM code.

add 42,fwd 1,add 10,fwd 1,add 10  # puts 42, 10, 10 in the register
jmp,sub 1,rwd 1                   # starts the first loop
jmp,sub 1,rwd 1,put,fwd 1,jnz     # second loop prints 42 or "*"
add 10,put,fwd 1                  # resets first loop, prints 10 or "\n"
                                  # first loop ends implicitly


ContentLicense: CC BY-SA 3.0

Title: Generating Binary shapes

Body:
How could we generate shapes or images using binary?

I got to messing around trying to create something that looked matrix like and got to thinking, wouldn't a great CodeGolf be to see who can make the best shortest code to generate a binary image?

Please advise me of any rules I should add.

Rules:

Create a binary image art of a Meme using 40 chars wide by 20 chars tall.

Shortest code out of top 3 voted images wins.

Example Output:

```<code>00000000000000000000000000000000000000000
00000000000000000000000000000000000000000
00000000000000000000000000000000000000000
00000000000000000000000000000000000000000
00000000000000000000000000000000000000000
00000000000000000000000000000000000000000
00000000000000000000000000000000000000000
00000000000000000000000000000000000000000
00000000001111000000000000011110000000000
00000000111111110000000001111111100000000
00000011110000111100001111000001111000000
00000011110000111100001111000001111000000
00000011110000111100001111000001111000000
00000011110000001111111100000001111000000
00000011110000000011110000000001111000000
00000011110000000000000000000001111000000
00000011110000000000000000000001111000000
00001111000000000000000000000000011110000
00111100000000000000000000000000000111100
11110000000000000000000000000000000001111
</code>```

Body:
New*** Can't Triforce (Perl, 85 chars)

map{$j=$_<10;$_=sprintf"%010d",1x($_%10+1);s/1(.*)/$&$1$`0/;say$_.($j?0 x20:$_)}0..19

output:

0000000001000000000000000000000000000000
0000000011100000000000000000000000000000
0000000111110000000000000000000000000000
0000001111111000000000000000000000000000
0000011111111100000000000000000000000000
0000111111111110000000000000000000000000
0001111111111111000000000000000000000000
0011111111111111100000000000000000000000
0111111111111111110000000000000000000000
1111111111111111111000000000000000000000
0000000001000000000000000000010000000000
0000000011100000000000000000111000000000
0000000111110000000000000001111100000000
0000001111111000000000000011111110000000
0000011111111100000000000111111111000000
0000111111111110000000001111111111100000
0001111111111111000000011111111111110000
0011111111111111100000111111111111111000
0111111111111111110001111111111111111100
1111111111111111111011111111111111111110


问:
Implement the divisibility-by-7 rule
To check whether a decimal number is divisible by 7:

Erase the last digit. Multiply it by 2 and subtract from what is left. If the result is divisible by 7, the original number is divisible by 7.

(also described e.g. here)

This rule is good for manual divisibility check. For example:

Is 2016 divisible by 7?

Subtract 6*2 from 201; we get 189. Is this divisible by 7? To check it, let's apply the rule again.

Subtract 9*2 from 18; we get 0. Therefore, 2016 is divisible by 7.

In this challenge, you should apply this rule until the divisibility status is obvious, that is, the number is not greater than 70 (however, see below for details). Make a function or a full program.

Input: a positive integer; your code should support inputs up to 32767 (supporting arbitrary-precision integers is a bonus; see below).

Output: an integer (possibly negative), not greater than 70, that is a result of applying the divisibility-by-7 rule zero or more times.

Test cases:

```<code>Input                   Output      Alternative output

1                       1
10                      10          1
100                     10          1
13                      13          -5
42                      42          0
2016                    0
9                       9
99                      -9
9999                    -3
12345                   3
32767                   28          -14

---------- Values below are only relevant for the bonus

700168844221            70          7
36893488147419103232    32          -1
231584178474632390847141970017375815706539969331281128078915168015826259279872    8
</code>```

Where two possible outputs are specified, either result is correct: the second one corresponds to applying the rule one more time. It's forbidden to apply the rule on a single-digit number: if you erase the digit, nothing (not 0) is left.

Bonus: If your algorithm

Supports arbitrary-precision integers

Performs only one pass on the input

Has space complexity o(n) (i.e. less than O(n)); and

Has time complexity O(n),

where n is the number of decimal digits:

Subtract 50% from your code's byte count.

Real bonus:

In addition, if your algorithm reads the input in normal direction, starting from the most significant digit, subtract 50% once again - your score is 25% of your byte count (it seems possible, but I'm not absolutely sure).

Title: Implement the divisibility-by-7 rule

Body:
Brain-Flak, <s>368</s> 360 bytes

<a href="http://brain-flak.tryitonline.net/#code=KFsoWyh7fSldPCgoKSk-KV0oPD4pKXsoe30oKSk8Pn17fTw-e317fTw-KCh7fSkpe3t9e308Pig8KCgpKT4pfXt9KHt9PD4pe3t9KCh7fSkpKDwoKCgpKCkoKSgpKCkpe308Pik-KTw-eyh7fVsoKV0pPD4oKHt9KClbKHt9KV0pKXt7fSg8KHt9KHt9KSk-KX17fTw-fXt9PD4oWyhbKFsoKHt9PHt9Pjw-KTwoW3t9XXt9KSg8KCgoKSgpKCkoKSgpKXt9KDw-KSk-KTw-eyh7fVsoKV0pPD4oKHt9KClbKHt9PCh7fSgpKT4pXSkpe3t9KDwoe30oe308KHt9WygpXSk-KSk-KX17fTw-fXt9PD57fXt9KHt9PD4pPil7fV17fSldPCgoKSk-KSg8PildKXsoe30oKSk8Pn17fTw-e317fTw-KCh7fSkpe3t9e308Pig8KCgpKT4pfXt9KHt9PD4pfXt9&input=MjAxNg" rel="nofollow">Try it Online!

([([({})]<(())>)](<>)){({}())<>}{}<>{}{}<>(({})){{}{}<>(<(())>)}{}({}<>){{}(({}))(<((()()()()()){}<>)>)<>{({}[()])<>(({}()[({})])){{}(<({}({}))>)}{}<>}{}<>([([([(({}<{}><>)<([{}]{})(<((()()()()()){}(<>))>)<>{({}[()])<>(({}()[({}<({}())>)])){{}(<({}({}<({}[()])>))>)}{}<>}{}<>{}{}({}<>)>){}]{})]<(())>)(<>)]){({}())<>}{}<>{}{}<>(({})){{}{}<>(<(())>)}{}({}<>)}{}

Explanation

To start off all of the code is in a loop that runs until the top of the stack is less than zero:

([([({})]<(())>)](<>)){({}())<>}{}<>{}{}<>(({})){{}{}<>(<(())>)}{}({}<>)
{{}
 ...
 ([([({})]<(())>)](<>)){({}())<>}{}<>{}{}<>(({})){{}{}<>(<(())>)}{}({}<>)
}{}

Inside of the loop we run the divisible by seven algorithm:

Duplicate the top of the stack

(({}))

Take the mod 10 of the top of the stack (last digit)

(<((()()()()()){}<>)>)<>{({}[()])<>(({}()[({})])){{}(<({}({}))>)}{}<>}{}<>({}<{}><>)

This is a bit of a mess but it does the rest of the algorithm I might explain it later but I don't entirely remember how it works:

([(({})<([{}]{})(<((()()()()()){}(<>))>)<>{({}[()])<>(({}()[({}<({}())>)])){{}(<({}({}<({}[()])>))>)}{}<>}{}<>{}{}({}<>)>){}]{})


问:
Golf an InterpretMe interpreter
This is a very simple challenge.

The joke language InterpretMe consists of one command; *, which causes the program to take input of an InterpretMe program and execute it.

An InterpretMe  program will interpret as many InterpretMe programs as there are * in input.

Your goal is to create a program that interprets InterpretMe in as few bytes as possible.

Input

Input will consist of one line ASCII strings, unicode utf-8 strings if you really want, or any character encoding that your language uses, if you want it that much. These strings can either be inputted at the start, or at the start of every run of InterpretMe interpreter. If they are all inputted at the start, the program must output every program line as it begins it.

Output

In this challenge, there will be no output unless the option of one input is chosen, otherwise only termination and non-termination

Test cases consist not of input and output, but input and termination. A newline denotes a new input to be interpreted as InterpretMe.

If using one input at the start, this could be considered what is outputted when these programs are inputted, followed by inactive (do nothing) lines.

```<code>1. *   (executes input as an interpret me program, finishes)
2. *   (^same)
3. **  (executes input as an interpret me program, then does this again after the first program is done, finishes)
4. hi  (nothing, first star of previous line finishes)
5. **  (same as the other two star line)
6. hi  (nothing, first star of previous line finishes)
7. hi  (nothing, second star of line 5 finishes, so second star of line 3 finishes, so line 2 finishes, so line one finishes)
[termination] (not outputted)
</code>```

```<code>hi  (does nothing and finishes)
[termination]
</code>```

```<code>*hi  (executes inputted program, finishes)
*yo  (executes inputted program, finishes)
hey  (nothing)
[termination]
</code>```

Again, this is code-golf, so fewer bytes is better

答:
Ruby, 29 bytes

i=1
i+=gets.count ?*while$.<i
```

Ruby's magical variable $. keeps track of the number of lines read from stdin. Keep reading input while this number is lower than the count of asterisks (plus the initial 1).

Title: Golf an InterpretMe interpreter

Body:
Ruby, 29 bytes

i=1
i+=gets.count ?*while$.<i

Ruby's magical variable $. keeps track of the number of lines read from stdin. Keep reading input while this number is lower than the count of asterisks (plus the initial 1).


问:
Only Even Bytes

The scenario

Lately you have been noticing some strange behavior with your favorite text editor. At first it seemed that it was ignoring random characters in your code when writing to disk. After a while you noticed a pattern; characters with odd ASCII values were being ignored. Under further inspection you discovered that you can only write to files properly if every eighth bit is zero.  Now you need to know if your valuable files have been affected by this strange bug.

The task

You must write a complete program that determines if a file contains any odd bytes (demonstrating it is uncorrupted).  But because of your text editor you cannot write any odd bytes in your source code. You may assume any pre-existing encoding for input, however you must still check every individual byte, not just characters.

Input

Your program will take the contents of or the path to a file from either stdin or command line.

Output

Your program will output to stdout either a truthy value if the given file contains an odd byte or a falsy if every eighth bit is zero.

Criteria

This is code golf, shortest program that completes the task wins.  To be a valid submission every eighth bit in the files source code must be a zero.  I would recommend including a copy of your source code's binaries in your submission.

Standard loopholes apply.

Test Cases

(In ASCII encoding)
    Input:

```<code>"$&(*,.02468:<>@BDFHJLNPRTVXZ\^`bdfhjlnprtvxz|~

Output:
falsy

Input:
!#%')+-/13579;=?ACEGIKMOQSUWY[]_acegikmoqsuwy{}

Output:
truthy

Input:
LOREMIPSVMDOLORSITAMETCONSECTETVRADIPISCINGELITSEDDOEIVSMODTEMPORINCIDIDVNTVTLABOREETDOLOREMAGNAALIQVA
VTENIMADMINIMVENIAMQVISNOSTRVDEXERCITATIONVLLAMCOLABORISNISIVTALIQVIPEXEACOMMODOCONSEQVAT
DVISAVTEIRVREDOLORINREPREHENDERITINVOLVPTATEVELITESSECILLVMDOLOREEVFVGIATNVLLAPARIATVR
EXCEPTEVRSINTOCCAECATCVPIDATATNONPROIDENTSVNTINCVLPAQVIOFFICIADESERVNTMOLLITANIMIDESTLABORVM

Output:
truthy
</code>```

Tips

Choose language wisely this challenge might not be possible in every language

The Unix command xxd -b <file name> will print the binaries of a file to the console (along with some extra formatting stuff)

You may use other encodings other than ASCII such as UTF-8 as long as all other rules are followed

答:
Perl 5 + -p0, 136 bytes

Similar to other answers, this removes all even bytes and leaves any odd bytes (which is truthy).

tr<�
� "$&(*,.02468:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~€‚„†ˆŠŒŽ�’”–˜šœž ¢¤¦¨ª¬®°²´¶¸º¼¾ÀÂÄÆÈÊÌÎÐÒÔÖØÚÜÞàâäæèêìîðòôöøúüþ><>d
```

Try it online!

Title: Only Even Bytes

Body:
Perl 5 + -p0, 136 bytes

Similar to other answers, this removes all even bytes and leaves any odd bytes (which is truthy).

tr<�
� "$&(*,.02468:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~€‚„†ˆŠŒŽ�’”–˜šœž ¢¤¦¨ª¬®°²´¶¸º¼¾ÀÂÄÆÈÊÌÎÐÒÔÖØÚÜÞàâäæèêìîðòôöøúüþ><>d

Try it online!


问:
Print a 10 by 10 grid of asterisks

Background

This is a standard textbook example to demonstrate for loops.

This is one of the first programs I learnt when I started learning programming ~10 years ago.

Task

You are to print this exact text:

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

Specs

You may have extra trailing newlines.

You may have extra trailing spaces (U+0020) at the end of each line, including the extra trailing newlines.

Scoring

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

Title: Print a 10 by 10 grid of asterisks

Body:
Go, 84 characters

package main;import"fmt";func main(){for j:=0;j<10;j++{fmt.Println("**********");}}

Sample run:

bash$ go build && ./golf
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********


问:
Count blocks in a 2D grid

Challenge description

Let's define an W x H grid as a two-dimensional array of length H whose each subarray is of length W. Example: a 2x3 grid (. character used as a blank):

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

A unit is a single point of a grid. A block is either a single unit or a set of contiguous units (meaning each unit of a block has at least another one next to, above or below it). In the 10x10 grid below there are 4 blocks (units represented by X's):

```<code>........X.   ........1.
..X.......   ..2.......
..X.......   ..2.......
..X.......   ..2.......
.......X..   .......3..
.......XX.   .......33.
.......XX.   .......33.
..X.......   ..4.......
..XX..X...   ..44..4...
...XXXX...   ...4444...
</code>```

Two blocks are distinct if either their positions in the grid or the number of blocks they consist of are different. In the 10x10 grid below there are 5 blocks (they're all 2x2 squares, but their positions are different, therefore they're distinct):

```<code>..........   ..........
.XX....XX.   .11....22.
.XX....XX.   .11....22.
..........   ..........
.......XX.   .......33.
.......XX.   .......33.
....XX....   ....44....
....XX....   ....44....
XX........   55........
XX........   55........
</code>```

Given two integers W and H (W, H > 0), calculate the number of distinct blocks that can be constructed within a W x H grid.

Sample inputs / outputs

```<code>(1, 1) -> 1     | only a 1x1 block can be constructed
(1, 2) -> 3     | two 1x1 blocks, and one 1x2 block
(2, 2) -> 13
(3, 3) -> 218
(4, 4) -> 11506
</code>```

Notes

Remember that this is a code-golf challenge, so make your code as short as possible!

Relevant sequences: A059525, A059020

Title: Count blocks in a 2D grid

Body:
Python 2, <s>208</s> <s>184</s> <s>169</s> <s>167</s> 163 bytes

w,h=input()
def f(x):global g;o=g;g&=~2**x;o>g>[x/w==(x+s)/w<f(x+s)or-1<x/w+s<h<f(x+s*w)for s in[-1,1]]
n=i=1<<w*h
while i:g=i=i-1;f(len(bin(g))-3);n-=g>0
print~-n


问:
A queen's walk across a spiral
In a far-off kingdom, a chess queen takes a daily walk across a spiral path, numbered from 1 to n, not caring to follow the spiral itself, but simply making queen's moves as she would on a chessboard. The queen is beloved by her subjects, and they make a note of every square she visits on her path. Given that the queen can start her walk on any square and ends it on any square, what is the shortest queen's walk that she can take?

The challenge

Given a spiral of integers on a rectangular grid, write a function that returns one of the shortest possible paths (counted by number of cells travelled) between two numbers on this spiral grid using a chess queen's moves.

For example, from 16 to 25:

```<code>25 10 11 12 13
24  9  2  3 14
23  8  1  4 15
22  7  6  5 16
21 20 19 18 17
</code>```

Some possible paths include 16, 4, 2, 10, 25 and 16, 5, 1, 9, 25.

Rules

The input will be any two positive integers.

The output will be a path of integers (including both endpoints) across the spiral using only orthogonal and diagonal moves.

The length of a path is counted by the number of cells travelled.

Your answer may be a program or a function.

This is code golf, so the smallest number of bytes wins.

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

Test cases

```<code>>>> queen_spiral(4, 5)
4, 5
>>> queen_spiral(13, 20)
13, 3, 1, 7, 20
>>> queen_spiral(14, 14)
14
>>> queen_spiral(10, 3)
10, 11, 3
>>> queen_spiral(16, 25)
16, 4, 2, 10, 25
>>> queen_spiral(80, 1)
80, 48, 24, 8, 1
</code>```

答:
Ruby, <s>262</s> <s>218</s> 216 bytes

This is a port of my Python answer. Golfing suggestions welcome.

Edit: 45 bytes thanks to Jordan and their suggestions of d=[0]*n=m*m;*e=c=0;*t=a, .rect, 0<=>x and x,y=(e[a]-g=e[b]).rect; t<<d[(g.real+x)*m+g.imag+y]. Another byte from (x+y*1i) to (x+y.i).

->a,b{m=([a,b].max**0.5).to_i+1;d=[0]*n=m*m;*e=c=0;*t=a
n.times{|k|d[c.real*m+c.imag]=k+1;e<<c;c+=1i**((4*k+1)**0.5-1).to_i}
x,y=(e[a]-g=e[b]).rect
(x+=0<=>x;y+=0<=>y;t<<d[(g.real+x)*m+g.imag+y])while(x+y.i).abs>0
t}
```

<p>Ungolfed:</p>

<pre class="lang-ruby prettyprint-override"><code>def q(a,b)
  m = ([a,b].max**0.5).to_i+1
  n = m*m
  d = [0]*n
  c = 0
  *e = c   # same as e=[0]
  *t = a   # same as t=[a]

  (1..n).each do |k|
    d[c.real * m + c.imag] = k+1
    e << c
    c += 1i**((4*k+1)**0.5-1).to_i
  end

  x, y = (e[a] - g=e[b]).rect

  while (x+y.i).abs > 0 do
    if x<0
      x += 1
    elsif x>0
      x += -1
    end

    if y<0
      y += 1
    elsif y>0
      y -= 1
    end

    t << d[(g.real+x)*m+g.imag+y]
  end

  return t
end
</code>```

Title: A queen's walk across a spiral

Body:
Ruby, <s>262</s> <s>218</s> 216 bytes

This is a port of my Python answer. Golfing suggestions welcome.

Edit: 45 bytes thanks to Jordan and their suggestions of d=[0]*n=m*m;*e=c=0;*t=a, .rect, 0<=>x and x,y=(e[a]-g=e[b]).rect; t<<d[(g.real+x)*m+g.imag+y]. Another byte from (x+y*1i) to (x+y.i).

->a,b{m=([a,b].max**0.5).to_i+1;d=[0]*n=m*m;*e=c=0;*t=a
n.times{|k|d[c.real*m+c.imag]=k+1;e<<c;c+=1i**((4*k+1)**0.5-1).to_i}
x,y=(e[a]-g=e[b]).rect
(x+=0<=>x;y+=0<=>y;t<<d[(g.real+x)*m+g.imag+y])while(x+y.i).abs>0
t}

Ungolfed:

def q(a,b)
  m = ([a,b].max**0.5).to_i+1
  n = m*m
  d = [0]*n
  c = 0
  *e = c   # same as e=[0]
  *t = a   # same as t=[a]

  (1..n).each do |k|
    d[c.real * m + c.imag] = k+1
    e << c
    c += 1i**((4*k+1)**0.5-1).to_i
  end

  x, y = (e[a] - g=e[b]).rect

  while (x+y.i).abs > 0 do
    if x<0
      x += 1
    elsif x>0
      x += -1
    end

    if y<0
      y += 1
    elsif y>0
      y -= 1
    end

    t << d[(g.real+x)*m+g.imag+y]
  end

  return t
end


Title: Print a 10 by 10 grid of asterisks

Body:
Background

This is a standard textbook example to demonstrate for loops.

This is one of the first programs I learnt when I started learning programming ~10 years ago.

Task

You are to print this exact text:

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

Specs

You may have extra trailing newlines.

You may have extra trailing spaces (U+0020) at the end of each line, including the extra trailing newlines.

Scoring

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

Body:
Bc, 26 characters

for(;i++<10;)"**********
"

Sample run:

bash-4.3$ bc <<< 'for(;i++<10;)"**********
"'
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********


答:
Mathematica, 38 bytes

```<code>f:=StringCases[InputString[],"*":>f];f
</code>```

Title: Golf an InterpretMe interpreter

Body:
This is a very simple challenge.

The joke language InterpretMe consists of one command; *, which causes the program to take input of an InterpretMe program and execute it.

An InterpretMe  program will interpret as many InterpretMe programs as there are * in input.

Your goal is to create a program that interprets InterpretMe in as few bytes as possible.

Input

Input will consist of one line ASCII strings, unicode utf-8 strings if you really want, or any character encoding that your language uses, if you want it that much. These strings can either be inputted at the start, or at the start of every run of InterpretMe interpreter. If they are all inputted at the start, the program must output every program line as it begins it.

Output

In this challenge, there will be no output unless the option of one input is chosen, otherwise only termination and non-termination

Test cases consist not of input and output, but input and termination. A newline denotes a new input to be interpreted as InterpretMe.

If using one input at the start, this could be considered what is outputted when these programs are inputted, followed by inactive (do nothing) lines.

```<code>1. *   (executes input as an interpret me program, finishes)
2. *   (^same)
3. **  (executes input as an interpret me program, then does this again after the first program is done, finishes)
4. hi  (nothing, first star of previous line finishes)
5. **  (same as the other two star line)
6. hi  (nothing, first star of previous line finishes)
7. hi  (nothing, second star of line 5 finishes, so second star of line 3 finishes, so line 2 finishes, so line one finishes)
[termination] (not outputted)
</code>```

```<code>hi  (does nothing and finishes)
[termination]
</code>```

```<code>*hi  (executes inputted program, finishes)
*yo  (executes inputted program, finishes)
hey  (nothing)
[termination]
</code>```

Again, this is code-golf, so fewer bytes is better

Body:
Mathematica, 38 bytes

f:=StringCases[InputString[],"*":>f];f


答:
C#, <s>111</s> 104 bytes

```<code>int d(int n){var s=""+n;return n<71?n:d(int.Parse(s.Remove(s.Length-1))-int.Parse(""+s[s.Length-1])*2);}
</code>```

Title: Implement the divisibility-by-7 rule

Body:
To check whether a decimal number is divisible by 7:

Erase the last digit. Multiply it by 2 and subtract from what is left. If the result is divisible by 7, the original number is divisible by 7.

(also described e.g. here)

This rule is good for manual divisibility check. For example:

Is 2016 divisible by 7?

Subtract 6*2 from 201; we get 189. Is this divisible by 7? To check it, let's apply the rule again.

Subtract 9*2 from 18; we get 0. Therefore, 2016 is divisible by 7.

In this challenge, you should apply this rule until the divisibility status is obvious, that is, the number is not greater than 70 (however, see below for details). Make a function or a full program.

Input: a positive integer; your code should support inputs up to 32767 (supporting arbitrary-precision integers is a bonus; see below).

Output: an integer (possibly negative), not greater than 70, that is a result of applying the divisibility-by-7 rule zero or more times.

Test cases:

```<code>Input                   Output      Alternative output

1                       1
10                      10          1
100                     10          1
13                      13          -5
42                      42          0
2016                    0
9                       9
99                      -9
9999                    -3
12345                   3
32767                   28          -14

---------- Values below are only relevant for the bonus

700168844221            70          7
36893488147419103232    32          -1
231584178474632390847141970017375815706539969331281128078915168015826259279872    8
</code>```

Where two possible outputs are specified, either result is correct: the second one corresponds to applying the rule one more time. It's forbidden to apply the rule on a single-digit number: if you erase the digit, nothing (not 0) is left.

Bonus: If your algorithm

Supports arbitrary-precision integers

Performs only one pass on the input

Has space complexity o(n) (i.e. less than O(n)); and

Has time complexity O(n),

where n is the number of decimal digits:

Subtract 50% from your code's byte count.

Real bonus:

In addition, if your algorithm reads the input in normal direction, starting from the most significant digit, subtract 50% once again - your score is 25% of your byte count (it seems possible, but I'm not absolutely sure).

Body:
C#, <s>111</s> 104 bytes

int d(int n){var s=""+n;return n<71?n:d(int.Parse(s.Remove(s.Length-1))-int.Parse(""+s[s.Length-1])*2);}


Title: Print a 10 by 10 grid of asterisks

Body:
Haskell, 34 bytes

putStr$[0..9]>>([0..9]>>"*")++"\n"

λ> putStr$[0..9]>>([0..9]>>"*")++"\n"
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********

ContentLicense: CC BY-SA 4.0


问:
Count up folks!

Introduction

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

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

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

Challenge

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

Rules

You can get n any way.

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

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

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

Standard loopholes are denied.

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

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

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

Bonuses

20%

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

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

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

答:
C#, 47 bytes

```<code>l=>{for(int i=1;i<=l;)Console.WriteLine(i++);};
</code>```

Title: Count up folks!

Body:
C#, 47 bytes

l=>{for(int i=1;i<=l;)Console.WriteLine(i++);};


Title: Print a 10 by 10 grid of asterisks

Body:
Underload, 22 bytes

(*****):*(
)*:*::*:**S


Title: Print a 10 by 10 grid of asterisks

Body:
JavaScript (115 106 81 chars)

o='';
for(i=0;i<10;i++){l='';for(j=0;j<10;j++){l+='*';}o+=l+"\n";}
console.log(o);


Title: Print a 10 by 10 grid of asterisks

Body:
HTML, 136 bytes

**********<br>**********<br>**********<br>**********<br>**********<br>**********<br>**********<br>**********<br>**********<br>**********


问:
Alphabet triangle
You are to print this exact text:

```<code>A
ABA
ABCBA
ABCDCBA
ABCDEDCBA
ABCDEFEDCBA
ABCDEFGFEDCBA
ABCDEFGHGFEDCBA
ABCDEFGHIHGFEDCBA
ABCDEFGHIJIHGFEDCBA
ABCDEFGHIJKJIHGFEDCBA
ABCDEFGHIJKLKJIHGFEDCBA
ABCDEFGHIJKLMLKJIHGFEDCBA
ABCDEFGHIJKLMNMLKJIHGFEDCBA
ABCDEFGHIJKLMNONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXYZYXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNONMLKJIHGFEDCBA
ABCDEFGHIJKLMNMLKJIHGFEDCBA
ABCDEFGHIJKLMLKJIHGFEDCBA
ABCDEFGHIJKLKJIHGFEDCBA
ABCDEFGHIJKJIHGFEDCBA
ABCDEFGHIJIHGFEDCBA
ABCDEFGHIHGFEDCBA
ABCDEFGHGFEDCBA
ABCDEFGFEDCBA
ABCDEFEDCBA
ABCDEDCBA
ABCDCBA
ABCBA
ABA
A
</code>```

Specs

Extra trailing newlines are allowed at the end of the output.

Extra trailing spaces (U+0020) are allowed at the end of each line, including the extra trailing newlines.

You can use all lowercase instead of all uppercase, but you cannot print partially lowercase partially uppercase.

You can return the text as a function output instead of printing it in a full program.

Scoring

Since this is a triangle, and a triangle has 3 sides, and 3 is a small number, your code should be small in terms of byte-count.

答:
R, <s>63 61</s> 59 bytes

```<code>for(i in c(1:26,25:1))cat(LETTERS[c(1:i,i:1-1)],"
",sep="")
</code>```

Helpfully LETTTERS[0] doesn't return any characters.

Edit: lost one thanks to @leakynun

Edit: two more thanks to @plannapus

Title: Alphabet triangle

Body:
R, <s>63 61</s> 59 bytes

for(i in c(1:26,25:1))cat(LETTERS[c(1:i,i:1-1)],"
",sep="")

Helpfully LETTTERS[0] doesn't return any characters.

Edit: lost one thanks to @leakynun

Edit: two more thanks to @plannapus


答:
MarioLANG, <s>101</s> <s>99</s> 95 bytes

Saved 2 bytes thanks to Martin Ender.

Try it Online!

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

The left half sets the tape to 10 40 10

The second half increases the 40 to 42, then prints the 42 (*) 10 times, and a newline, and repeats that 10 times.

Title: Print a 10 by 10 grid of asterisks

Body:
MarioLANG, <s>101</s> <s>99</s> 95 bytes

Saved 2 bytes thanks to Martin Ender.

Try it Online!

+
++++)+<......(<
++====".======"
+>)+(()>...(.
+====(-=====) -
+++++[!))++ )[!
======#=======#

The left half sets the tape to 10 40 10

The second half increases the 40 to 42, then prints the 42 (*) 10 times, and a newline, and repeats that 10 times.


问:
Modulo code golf
Write a function f(a,b) that returns a mod b given the constraints:

you can't use division in any way

f(a,b) is always positive, eg: f(-1,5) = 4

it performs reasonably well for values of ~10e50 for a and b

Title: Modulo code golf

Body:
Ruby - 72 chars

f=->a,b{a==b&&0||a<b&&a+(a<0&&b||0)||(t=b;t<<=1until t>a;f[a-(t>>1),b])}

Uses recursion like a Binary Search to find the remainder.

Test

p f[106, 95]
p f[23, 2]
p f[-1, 5]
p f[20, 7]
p f[10**100, 3]
p f[4*10**200, 3123123]

11
1
4
6
1
823660

ContentLicense: CC BY-SA 2.5


问:
Fastest semiprime factorization
Write a program to factorize a semi-prime number in the shortest amount of time.

For testing purposes, use this:
\$38!+1\$ (\$523022617466601111760007224100074291200000001\$)

It is equal to:
\$14029308060317546154181 × 37280713718589679646221\$

答:
Well, your 38!+1 broke my php script, not sure why. In fact, any semi-prime over 16 digits long breaks my script.

However, using 8980935344490257 ( 86028157 * 104395301 ) my script managed a time of 25.963 seconds on my home computer (2.61GHz AMD Phenom 9950). A lot faster than my work computer which was nearly 31 seconds @ 2.93GHz Core 2 Duo.

php - 757 chars incl. new lines

```<code><?php
function getTime() {
    $t = explode( ' ', microtime() );
    $t = $t[1] + $t[0];
    return $t;
}
function isDecimal($val){ return is_numeric($val) && floor($val) != $val;}
$start = getTime();
$semi_prime = 8980935344490257;
$slice      = round(strlen($semi_prime)/2);
$max        = (pow(10, ($slice))-1);
$i          = 3;
echo "\nFactoring the semi-prime:\n$semi_prime\n\n";

while ($i < $max) {
    $sec_factor = ($semi_prime/$i);
    if (isDecimal($sec_factor) != 1) {
        $mod_f = bcmod($i, 1);
        $mod_s = bcmod($sec_factor, 1);
        if ($mod_f == 0 && $mod_s == 0) {
            echo "First factor = $i\n";
            echo "Second factor = $sec_factor\n";
            $end=getTime();
            $xtime=round($end-$start,4).' seconds';
            echo "\n$xtime\n";
            exit();
        }
    }
    $i += 2;
}
?>
</code>```

I'd be interested to see this same algorithm in c or some other compiled language.

Title: Fastest semiprime factorization

Body:
Well, your 38!+1 broke my php script, not sure why. In fact, any semi-prime over 16 digits long breaks my script.

However, using 8980935344490257 ( 86028157 * 104395301 ) my script managed a time of 25.963 seconds on my home computer (2.61GHz AMD Phenom 9950). A lot faster than my work computer which was nearly 31 seconds @ 2.93GHz Core 2 Duo.

php - 757 chars incl. new lines

<?php
function getTime() {
    $t = explode( ' ', microtime() );
    $t = $t[1] + $t[0];
    return $t;
}
function isDecimal($val){ return is_numeric($val) && floor($val) != $val;}
$start = getTime();
$semi_prime = 8980935344490257;
$slice      = round(strlen($semi_prime)/2);
$max        = (pow(10, ($slice))-1);
$i          = 3;
echo "\nFactoring the semi-prime:\n$semi_prime\n\n";

while ($i < $max) {
    $sec_factor = ($semi_prime/$i);
    if (isDecimal($sec_factor) != 1) {
        $mod_f = bcmod($i, 1);
        $mod_s = bcmod($sec_factor, 1);
        if ($mod_f == 0 && $mod_s == 0) {
            echo "First factor = $i\n";
            echo "Second factor = $sec_factor\n";
            $end=getTime();
            $xtime=round($end-$start,4).' seconds';
            echo "\n$xtime\n";
            exit();
        }
    }
    $i += 2;
}
?>

I'd be interested to see this same algorithm in c or some other compiled language.


答:
Emojicode, 54 bytes

```<code>i⏩0 10**********
</code>```

Explanation:

```<code>                         The beginning of program.
     i ⏩ 0 10            This is called a "range".
                          It basically starts with i=0 and increments until i=10, then exits.
         **********      is printing class.
                          The s make the characters they surround string literals.
                          End of range
                          End of program
</code>```

Title: Print a 10 by 10 grid of asterisks

Body:
Emojicode, 54 bytes

i⏩0 10**********

Explanation:

                         The beginning of program.
     i ⏩ 0 10            This is called a "range".
                          It basically starts with i=0 and increments until i=10, then exits.
         **********      is printing class.
                          The s make the characters they surround string literals.
                          End of range
                          End of program


问:
"99 Bottles of Beer"
Write a program that outputs the lyrics to 99 Bottles of Beer, in as few bytes as possible.

Lyrics:

```<code>99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.

98 bottles of beer on the wall, 98 bottles of beer.
Take one down and pass it around, 97 bottles of beer on the wall.

97 bottles of beer on the wall, 97 bottles of beer.
Take one down and pass it around, 96 bottles of beer on the wall.

96 bottles of beer on the wall, 96 bottles of beer.
Take one down and pass it around, 95 bottles of beer on the wall.

95 bottles of beer on the wall, 95 bottles of beer.
Take one down and pass it around, 94 bottles of beer on the wall.

....

3 bottles of beer on the wall, 3 bottles of beer.
Take one down and pass it around, 2 bottles of beer on the wall.

2 bottles of beer on the wall, 2 bottles of beer.
Take one down and pass it around, 1 bottle of beer on the wall.

1 bottle of beer on the wall, 1 bottle of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.
</code>```

Rules:

Your program must log to STDOUT or an acceptable alternative, or be returned from a function (with or without a trailing newline).

Your program must be a full, runnable program or function.

Languages specifically written to submit a 0-byte answer to this challenge are allowed, just not particularly interesting.

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

This is different from the output by HQ9+ or 99. Any answers written in these languages will be deleted.

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

Catalogue

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

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

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

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

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

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

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

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

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
R, 138 225 bytes

    a='bottles of beer on the';for(i in 99:1)cat("",i,a,"wall,",i,"bottles of beer.\n","Take one down and pass it around,",i-1,a,"wall.\n\n")

```<code>a='bottles of beer on the'
for(i in 99:2)
    cat("",i,a,"wall,",i,"bottles of beer.\n","Take one down and pass it around,",i-1,a,"wall.\n\n")
cat(1,a,"wall,","1 bottle of beer.\nGo to the store and buy some more,",99,a,"wall.")
</code>```

EDIT-- missed the change in the last verse.

Title: "99 Bottles of Beer"

Body:
R, 138 225 bytes

    a='bottles of beer on the';for(i in 99:1)cat("",i,a,"wall,",i,"bottles of beer.\n","Take one down and pass it around,",i-1,a,"wall.\n\n")

a='bottles of beer on the'
for(i in 99:2)
    cat("",i,a,"wall,",i,"bottles of beer.\n","Take one down and pass it around,",i-1,a,"wall.\n\n")
cat(1,a,"wall,","1 bottle of beer.\nGo to the store and buy some more,",99,a,"wall.")

EDIT-- missed the change in the last verse.


答:
JavaScript (177 175 chars)

This is my best attempt at golfing this problem. I cannot find a way to do this with fewer characters

o='';

for(i=1;i<=26;i++){
 l='';
  for(j=1;j<=i;j++){
   l+=String.fromCharCode(j+64);
  }
 o+=l+l.slice(0,l.indexOf(l.slice(-1))).split('').reverse().join('')+"\n";
}

console.log(o);```

Title: Alphabet triangle

Body:
You are to print this exact text:

```<code>A
ABA
ABCBA
ABCDCBA
ABCDEDCBA
ABCDEFEDCBA
ABCDEFGFEDCBA
ABCDEFGHGFEDCBA
ABCDEFGHIHGFEDCBA
ABCDEFGHIJIHGFEDCBA
ABCDEFGHIJKJIHGFEDCBA
ABCDEFGHIJKLKJIHGFEDCBA
ABCDEFGHIJKLMLKJIHGFEDCBA
ABCDEFGHIJKLMNMLKJIHGFEDCBA
ABCDEFGHIJKLMNONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXYZYXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXYXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWXWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVWVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUVUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTUTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSTSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRSRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQRQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPQPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNOPONMLKJIHGFEDCBA
ABCDEFGHIJKLMNONMLKJIHGFEDCBA
ABCDEFGHIJKLMNMLKJIHGFEDCBA
ABCDEFGHIJKLMLKJIHGFEDCBA
ABCDEFGHIJKLKJIHGFEDCBA
ABCDEFGHIJKJIHGFEDCBA
ABCDEFGHIJIHGFEDCBA
ABCDEFGHIHGFEDCBA
ABCDEFGHGFEDCBA
ABCDEFGFEDCBA
ABCDEFEDCBA
ABCDEDCBA
ABCDCBA
ABCBA
ABA
A
</code>```

Specs

Extra trailing newlines are allowed at the end of the output.

Extra trailing spaces (U+0020) are allowed at the end of each line, including the extra trailing newlines.

You can use all lowercase instead of all uppercase, but you cannot print partially lowercase partially uppercase.

You can return the text as a function output instead of printing it in a full program.

Scoring

Since this is a triangle, and a triangle has 3 sides, and 3 is a small number, your code should be small in terms of byte-count.


答:
ListSharp, 73 bytes

```<code>[FOREACH NUMB IN 1 TO 10 AS k]
{
STRG p=p+"**********"+<newline>
}
SHOW=p
</code>```

Title: Print a 10 by 10 grid of asterisks

Body:
Background

This is a standard textbook example to demonstrate for loops.

This is one of the first programs I learnt when I started learning programming ~10 years ago.

Task

You are to print this exact text:

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

Specs

You may have extra trailing newlines.

You may have extra trailing spaces (U+0020) at the end of each line, including the extra trailing newlines.

Scoring

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

Body:
ListSharp, 73 bytes

[FOREACH NUMB IN 1 TO 10 AS k]
{
STRG p=p+"**********"+<newline>
}
SHOW=p


答:
R, 82, 53, 49 bytes (48 bytes w/ different input style)

```<code>b=d=1;a=0;for(i in 1:scan()){d=d*b;b=a+b;a=b-a};d
</code>```

If we can just precede the code with the input number, we get the 48 byte

```<code>->n;b=d=1;a=0;for(i in 1:n){d=d*b;b=a+b;a=b-a};d
</code>```

EDIT: New code. Original is below:

```<code>a=function(n)ifelse(n<3,1,{v=c(1,1,3:n);for(i in 3:n)v[i]=v[i-1]+v[i-2];prod(v)})
</code>```

Won't return anything other than Inf for a(100) though. And it won't work for anything but non-negative integers.

Ungolfed:

```<code>a=function(n){
   if(n<3) return(1)
   v=c(1,1,3:n)
   for(i in 3:n)
       v[i]=v[i-1]+v[i-2]
   prod(v)
}
</code>```

Title: Fibonacci-orial

Body:
Definition

Fibonacci sequence F(n), on the positive integers, are defined as such:

```<code>1. F(1) = 1
2. F(2) = 1
3. F(n) = F(n-1) + F(n-2), where n is an integer and n > 2
</code>```

The Fibonacci-orial of a positive integer is the product of [F(1), F(2), ..., F(n)].

Task

Given positive integer n, find the Fibonacci-orial of n.

Specs

The fibonacci-orial of 100 must compute in under 5 seconds on a reasonable computer.

Testcases

```<code>n   Fibonacci-orial of n
1   1
2   1
3   2
4   6
5   30
6   240
7   3120
8   65520
9   2227680
10  122522400
11  10904493600
12  1570247078400
13  365867569267200
14  137932073613734400
15  84138564904377984000
16  83044763560621070208000
17  132622487406311849122176000
18  342696507457909818131702784000
19  1432814097681520949608649339904000
20  9692987370815489224102512784450560000
100 3371601853146468125386964065447576689828006172937411310662486977801540671138589868616500834190029067583665182291701553172011082574587431382310099030394306877775647395167143332483560925112960024644459715300507481235056111434293619038347456390454209587101225261757371666449068625033999573552165524529725467628060170886602001077137613803027158648329335507728698605769992818756765633305318529965186184043999696650407246193257877568825245646129366994079739720698147440310773871269639752334356493678913424390564535389212240038895626811627949132978086070255082668392290037141141291484839596694182152062726390364094447642643912371532491388089634845995941928089653751672688740718152064107169357399466473375804972260594768969952507346694189050233823596316467570584434128052398891223730335019092974935617029638919358286124350711360361279157416837428904150054292406756317837582840596331363581207781793070936765786629772999832857257349696094416616259974304208756997835360702840912518532683324936435856348020736000000000000000000000000
</code>```

References

Obligatory OEIS A003266

OEIS A000045 - Fibonacci sequence

Body:
R, 82, 53, 49 bytes (48 bytes w/ different input style)

b=d=1;a=0;for(i in 1:scan()){d=d*b;b=a+b;a=b-a};d

If we can just precede the code with the input number, we get the 48 byte

->n;b=d=1;a=0;for(i in 1:n){d=d*b;b=a+b;a=b-a};d

EDIT: New code. Original is below:

a=function(n)ifelse(n<3,1,{v=c(1,1,3:n);for(i in 3:n)v[i]=v[i-1]+v[i-2];prod(v)})

Won't return anything other than Inf for a(100) though. And it won't work for anything but non-negative integers.

Ungolfed:

a=function(n){
   if(n<3) return(1)
   v=c(1,1,3:n)
   for(i in 3:n)
       v[i]=v[i-1]+v[i-2]
   prod(v)
}


答:
Perl, 33 bytes

```<code>for(my$c;$c+=()=<>=~/\*/g;$c--){}
</code>```

Counts the number of times that * occurs in the input and adds that to the number of times it loops. I feel like there should be a way to do the decrementing in the same step as incrementing but I couldn't figure it out.

Title: Golf an InterpretMe interpreter

Body:
This is a very simple challenge.

The joke language InterpretMe consists of one command; *, which causes the program to take input of an InterpretMe program and execute it.

An InterpretMe  program will interpret as many InterpretMe programs as there are * in input.

Your goal is to create a program that interprets InterpretMe in as few bytes as possible.

Input

Input will consist of one line ASCII strings, unicode utf-8 strings if you really want, or any character encoding that your language uses, if you want it that much. These strings can either be inputted at the start, or at the start of every run of InterpretMe interpreter. If they are all inputted at the start, the program must output every program line as it begins it.

Output

In this challenge, there will be no output unless the option of one input is chosen, otherwise only termination and non-termination

Test cases consist not of input and output, but input and termination. A newline denotes a new input to be interpreted as InterpretMe.

If using one input at the start, this could be considered what is outputted when these programs are inputted, followed by inactive (do nothing) lines.

```<code>1. *   (executes input as an interpret me program, finishes)
2. *   (^same)
3. **  (executes input as an interpret me program, then does this again after the first program is done, finishes)
4. hi  (nothing, first star of previous line finishes)
5. **  (same as the other two star line)
6. hi  (nothing, first star of previous line finishes)
7. hi  (nothing, second star of line 5 finishes, so second star of line 3 finishes, so line 2 finishes, so line one finishes)
[termination] (not outputted)
</code>```

```<code>hi  (does nothing and finishes)
[termination]
</code>```

```<code>*hi  (executes inputted program, finishes)
*yo  (executes inputted program, finishes)
hey  (nothing)
[termination]
</code>```

Again, this is code-golf, so fewer bytes is better

Body:
Perl, 33 bytes

for(my$c;$c+=()=<>=~/\*/g;$c--){}

Counts the number of times that * occurs in the input and adds that to the number of times it loops. I feel like there should be a way to do the decrementing in the same step as incrementing but I couldn't figure it out.


问:
Snakes all around

Challenge

The challenge is simple: print a snake.

You will get the length of the snake as input.

A snake of length 2 looks like this:

```<code>==(:)-
</code>```

A snake of length 7 looks like this:

```<code>=======(:)-
</code>```

In other words, the length of a snake is how many equal signs are before the head.

Usage

Let's say I made a C++ implementation and compiled it to ./getsnake.

I could run it like so:

```<code>$ ./getsnake 10
==========(:)-
</code>```

Clarifications

Standard loopholes are disallowed.

You can get input and output in any acceptable way.

You can assume all inputs given are positive integers.

You may write a function instead of a regular program.

答:
R, 39 bytes

Mildly different than others above

```<code>for(i in 1:scan())cat("=");cat("(:)-")
</code>```

or, if we can precede the line with the input

```<code>->n;for(i in 1:n)cat("=");cat("(:)-")
</code>```

Title: Snakes all around

Body:
R, 39 bytes

Mildly different than others above

for(i in 1:scan())cat("=");cat("(:)-")

or, if we can precede the line with the input

->n;for(i in 1:n)cat("=");cat("(:)-")


答:
Javascript (ES6), 113 bytes

```<code>i=>{for(i=0;i<51;i++,console.log(L))for(j=s=i<26?i:50-i,L="";j>=0;)k=String.fromCharCode(65+j),L=k+(j---s?L+k:L)}
</code>```

Thanks to manatwork for pointing me to a tip written by William Barbosa to reduce by a byte.

Title: Alphabet triangle

Body:
Javascript (ES6), 113 bytes

i=>{for(i=0;i<51;i++,console.log(L))for(j=s=i<26?i:50-i,L="";j>=0;)k=String.fromCharCode(65+j),L=k+(j---s?L+k:L)}

Thanks to manatwork for pointing me to a tip written by William Barbosa to reduce by a byte.


答:
Perl, 16 bytes

```<code>say'='x<>.'(:)-'
</code>```

Takes input from stdin

Title: Snakes all around

Body:
Challenge

The challenge is simple: print a snake.

You will get the length of the snake as input.

A snake of length 2 looks like this:

```<code>==(:)-
</code>```

A snake of length 7 looks like this:

```<code>=======(:)-
</code>```

In other words, the length of a snake is how many equal signs are before the head.

Usage

Let's say I made a C++ implementation and compiled it to ./getsnake.

I could run it like so:

```<code>$ ./getsnake 10
==========(:)-
</code>```

Clarifications

Standard loopholes are disallowed.

You can get input and output in any acceptable way.

You can assume all inputs given are positive integers.

You may write a function instead of a regular program.

Body:
Perl, 16 bytes

say'='x<>.'(:)-'

Takes input from stdin


答:
Javascript, 2227 bytes

@Peter Taylor: Challenge Accepted!

```_='S=b9b?b^3?"{"+)+"}":\'"\'+)+\'"\':"["+b6SB" ")+"]":""+b};$=b||!b99b:[b]b6$B""L;M=b9$(bb+""};A=b?(gb.charCodeAt(0)A(b1))v=g,v=3,g,v};C=b9(k=b6Ck=b,kb};a=g,s,O,r=Wj,uX,d,c,i,yPb=(b?$(bb+"").match(/\'(.|[^\'])*\'|"(.|[^"])*"|-?\\d+|\\043[^\\n]*|[a-z_]\\w*|./imgFi=y=0;z=b[i++];)"{"Yz?!y++Zk=iy?"}"Yz!--yZe=A(bk,i-1B""))e=4\'"\'YzQ?A(eval(z.replace("\\n","n")))"\'"YzQ?A(z1,-1).replace(/(|\')/g,"$1"))":"Yz?r[b[i++]]=(d=s[s-1])^4?S(dd:r[z]?r[z]z+"."-0.1?eval(z)eval("//~t;t98?ts=st~t\\140A(S(G)))//[O.uns]JEt,u@`vEuX,v%`I!u)t%u!tPt3?[32]:[]Xu+tV-5!~tc)RcL# q-t/`I!u)Math.floot/u)!tPv=0;j%tY0ZvRvv,vvcdvLu^4Pp=1 ITPFd;\'.\'u;)ds[s-1]tGdL#{D;HL//*7I!t)q*t!uPFd;u--;)T?td=dCUd=8;T||dL8^4P!u8Zu6M)6A)d=dC(j?t:[]cd=8;GdL#{q.)HL//zipt;Fv=c;v--;)!d[v]Zd[v]d[v]c[v]?7IT)HG)Zcu# t9tuMath.pow(uX)$t;u=0;t9(T?(u=t,G)t).sort(uZaua,bubb-a}C(s~t)Q)=`t!9ut)Q:0|$(u)Y$U>N$U|0:t0Xu>t|0V)K()]:[t+1](K.)]:[t-1]&5v;~tc)vc   &t|5dvt |t^5v;k,ut!~tc)^!~kc)vc ^tif`v=?u:t;v^4?A(S(v)v!+!randMath.random()*G)|0)".split("//"+z)[1]L,\'{1$if}:and{1$if}:or{!!{!}*}:xor{..0sZOQ=sFfoGs(HctIif(Js.splice(O.))Kt;s=st9[tXL)}N`q9t9$(u)P){Q[0]RdT8>3U(t)V8//Wfunction(b,X,tY==Z(`;qu';for(Y=0;$='q`ZYXWVUTRQPNLKJIHGFEDB98765#  '[Y++];)with(_.split($))_=join(pop());eval(_)```

Note: Contains some control characters, nothing outside of ASCII though. Here's a direct link to the file: gs.js. The code provides a function a which takes the Golfscript code as a single parameter and returns the resulting stack as an array, with strings and blocks represented as ASCII.

Differences from the official interpreter:

Numbers have only 53 bits precision

No exact output and no direct print (would be easy to add though)

Double quoted strings are parsed using Javascript's eval, which might work different than Ruby's. Also no access to Ruby functions via strings

Undefined behaviour (I tried my very best)

I've also made a bunch of test cases and set up a small form for running Golfscript code: http://copy.sh/golfscript/

Here are some examples:

pi, phi

fizzbuzz

primality test

a quine

This is my standard Golfscript library, suggestions are welcome:

```<code>{1$if}:and
{1$\\if}:or
{\!!{!}*}:xor
{..0<2**-}:abs
{\{!}+\while}:until
{0$}:.
"\n":n
{\.[]*{0{2$*\(@+1$}do@;\;}{[{.@.@\\%@@.@\/.}do;;]-1%}if}:base
];
</code>```

Title: The GolfScript Meta Par Hole

Body:
Seem like GolfScript wins all of these. So you can't beat them, join them.

Write an Self-Contained Golfscript Interpreter

I'm using the definition of self-contained to mean, a single program:- So no passing the buck to some external program to do the work for you.

Test Cases:

Strings and blocks are represented as lists of ASCII codes. Types are not checked with these tests, but should be right anyway.

```<code>test("[50] [60]+", [[50, 60]]);
test("{a} {b}+", [[97, 32, 98]]);
test("'a' 'b'+", [[97, 98]]);

test("' ' 0+", [[32, 48]]);
test("' ' [50]+", [[32, 50]]);

test("{a} 0+", [[97, 32, 48]]);
test("{a} [50]+", [[97, 32, 53, 48]]);

test("5 ~", [-6]);
test('"1 2+"~', [3]);
test('{1 2+}~', [3]);
test('[1 2 3]~', [1, 2, 3]);

test('1`', [[49]]);
test("[1 [2] 'asdf']`", [[91, 49, 32, 91, 50, 93, 32, 34, 97, 115, 100, 102, 34, 93]]);
test('"1"`', [[34, 49, 34]]);
test("{1}`", [[123, 49, 125]]);

test("0!", [1]);
test("[]!", [1]);
test("{}!", [1]);
test("''!", [1]);

test("5!", [0]);
test("[[]]!", [0]);
test("{{}}!", [0]);
test("'asdf'!", [0]);

test("1 2 3 4 @", [1, 3, 4, 2]);

test("1 # 2", [1]);

test("1 2 3 4 5 1 $", [1, 2, 3, 4, 5, 4]);
test("'asdf' $", [[97, 100, 102, 115]]);
test("[5 4 3 1 2]{-1*}$", [[5, 4, 3, 2, 1]]);

test("5 7 +", [12]);
test("'a'{b}+", [[97, 32, 98]]);
test("[1 2 3][4 5]+", [[1, 2, 3, 4, 5]]);

test("1 2-3+", [1, -1]);
test("1 2 -3+", [1, -1]);
test("1 2- 3+", [2]);
test("[5 2 5 4 1 1][1 2]-", [[5, 5, 4]]);

test("2 4*", [8]);
test("2 {2*} 5*", [64]);
test("[1 2 3]2*", [[1, 2, 3, 1, 2, 3]]);
test("3'asdf'*", [[97,115,100,102,97,115,100,102,97,115,100,102]]);

test("[1 2 3]' '*", [[49, 32, 50, 32, 51]]);
test("[1 2 3][4]*", [[1,4,2,4,3]]);
test("'asdf'' '*", [[97,32,115,32,100,32,102]]);
test("[1 [2] [3 [4 [5]]]]' '*", [[49, 32, 2, 32, 3, 4, 5]]);
test("[1 [2] [3 [4 [5]]]][6 7]*", [[1, 6, 7, 2, 6, 7, 3, [4, [5]]]]);

test("[1 2 3 4]{+}*", [10]);
test("'asdf'{+}*", [414]);

test("7 3 /", [2]);
test("[1 2 3 4 2 3 5][2 3]/", [[[1], [4], [5]]]);
test("[1 2 3 4 5] 2/", [[[1, 2], [3, 4], [5]]]);

test("0 1 {10<} { .@+ } /", [8, [1, 1, 2, 3, 5, 8]]);
test("[1 2 3]{1+}/", [2, 3, 4]);

test("7 3 %", [1]);

test("'assdfs' 's'%", [[[97], [100, 102]]]);
test("'assdfs' 's'/", [[[97], [], [100, 102], []]]);

test("[1 2 3 4 5] 2%", [[1, 3, 5]]);
test("[1 2 3 4 5] -1%", [[5, 4, 3, 2, 1]]);
test("[1 2 3] {1+}%", [[2, 3, 4]]);

test("5 3 |", [7]);
test("[5 5 1] [1 3] |", [[5, 1, 3]]);

test("5 3 &", [1]);
test("[1 1 2 2][1 3]&", [[1]]);

test("5 3 ^", [6]);
test("[1 1 2 2][1 3]^", [[2, 3]]);

test("1 2 [\\]", [[2, 1]]);

test("1 2 3 \\", [1, 3, 2]);
test("1 2 3; ", [1, 2]);

test("3 4 <", [1]);
test('"asdf" "asdg" <', [1]);
test("[1 2 3] 2 <", [[1, 2]]);
test("{asdf} -1 <", [[97, 115, 100]]);

test("3 4 >", [0]);
test('"asdf" "asdg" >', [0]);
test("[1 2 3] 2 >", [[3]]);
test("{asdf} -1 >", [[102]]);

test("3 4 =", [0]);
test('"asdf" "asdg" =', [0]);
test("[1 2 3] 2 =", [3]);
test("{asdf} -1 =", [102]);

test("3,", [[0,1,2]]);
test("10,,", [10]);
test("10,{3%},", [[1, 2, 4, 5, 7, 8]]);

test("1 2 .", [1,2,2]);

test("2 8?", [256]);
test(" 5 [4 3 5 1] ?", [2]);
test(" 6 [4 3 5 1] ?", [-1]);

test("[1 2 3 4 5 6] {.* 20>} ?", [5]);

test("5(", [4]);
test("[1 2 3](", [[2, 3], 1]);

test("5)", [6]);
test("[1 2 3])", [[1, 2], 3]);

test("5 {1 0/} or", [5]);
test("5 {1 1+} and", [2]);
test("0 [3] xor", [[3]]);
test("2 [3] xor", [0]);

test("5{1-..}do", [4, 3, 2, 1, 0, 0]);
test("5{.}{1-.}while", [4, 3, 2, 1, 0, 0]);
test("5{.}{1-.}until", [5]);

test("1 2 3 if", [2]);
test("0 2 {1.} if", [1, 1]);

test("[[1 2 3][4 5 6][7 8 9]]zip", [[[1, 4, 7], [2, 5, 8], [3, 6, 9]]]);

test("[1 1 0] 2 base", [6]);
test("6 2 base", [[1, 1, 0]]);
</code>```

Body:
Javascript, 2227 bytes

@Peter Taylor: Challenge Accepted!

_='S=b9b?b^3?"{"+)+"}":\'"\'+)+\'"\':"["+b6SB" ")+"]":""+b};$=b||!b99b:[b]b6$B""L;M=b9$(bb+""};A=b?(gb.charCodeAt(0)A(b1))v=g,v=3,g,v};C=b9(k=b6Ck=b,kb};a=g,s,O,r=Wj,uX,d,c,i,yPb=(b?$(bb+"").match(/\'(.|[^\'])*\'|"(.|[^"])*"|-?\\d+|\\043[^\\n]*|[a-z_]\\w*|./imgFi=y=0;z=b[i++];)"{"Yz?!y++Zk=iy?"}"Yz!--yZe=A(bk,i-1B""))e=4\'"\'YzQ?A(eval(z.replace("\\n","n")))"\'"YzQ?A(z1,-1).replace(/(|\')/g,"$1"))":"Yz?r[b[i++]]=(d=s[s-1])^4?S(dd:r[z]?r[z]z+"."-0.1?eval(z)eval("//~t;t98?ts=st~t\\140A(S(G)))//[O.uns]JEt,u@`vEuX,v%`I!u)t%u!tPt3?[32]:[]Xu+tV-5!~tc)RcL# q-t/`I!u)Math.floot/u)!tPv=0;j%tY0ZvRvv,vvcdvLu^4Pp=1 ITPFd;\'.\'u;)ds[s-1]tGdL#{D;HL//*7I!t)q*t!uPFd;u--;)T?td=dCUd=8;T||dL8^4P!u8Zu6M)6A)d=dC(j?t:[]cd=8;GdL#{q.)HL//zipt;Fv=c;v--;)!d[v]Zd[v]d[v]c[v]?7IT)HG)Zcu# t9tuMath.pow(uX)$t;u=0;t9(T?(u=t,G)t).sort(uZaua,bubb-a}C(s~t)Q)=`t!9ut)Q:0|$(u)Y$U>N$U|0:t0Xu>t|0V)K()]:[t+1](K.)]:[t-1]&5v;~tc)vc   &t|5dvt |t^5v;k,ut!~tc)^!~kc)vc ^tif`v=?u:t;v^4?A(S(v)v!+!randMath.random()*G)|0)".split("//"+z)[1]L,\'{1$if}:and{1$if}:or{!!{!}*}:xor{..0sZOQ=sFfoGs(HctIif(Js.splice(O.))Kt;s=st9[tXL)}N`q9t9$(u)P){Q[0]RdT8>3U(t)V8//Wfunction(b,X,tY==Z(`;qu';for(Y=0;$='q`ZYXWVUTRQPNLKJIHGFEDB98765#  '[Y++];)with(_.split($))_=join(pop());eval(_)

Note: Contains some control characters, nothing outside of ASCII though. Here's a direct link to the file: gs.js. The code provides a function a which takes the Golfscript code as a single parameter and returns the resulting stack as an array, with strings and blocks represented as ASCII.

Differences from the official interpreter:

Numbers have only 53 bits precision

No exact output and no direct print (would be easy to add though)

Double quoted strings are parsed using Javascript's eval, which might work different than Ruby's. Also no access to Ruby functions via strings

Undefined behaviour (I tried my very best)

I've also made a bunch of test cases and set up a small form for running Golfscript code: http://copy.sh/golfscript/

Here are some examples:

pi, phi

fizzbuzz

primality test

a quine

This is my standard Golfscript library, suggestions are welcome:

{1$if}:and
{1$\\if}:or
{\!!{!}*}:xor
{..0<2**-}:abs
{\{!}+\while}:until
{0$}:.
"\n":n
{\.[]*{0{2$*\(@+1$}do@;\;}{[{.@.@\\%@@.@\/.}do;;]-1%}if}:base
];


答:
PowerShell v3+, 86 bytes

```<code>param($n)$f=,1*$n;2..$n|%{$f[$_]=$f[$_-1]+$f[$_-2]};"[bigint]"+($f[0..$n]-join'*')|iex
</code>```

The [bigint] data structure was introduced in .NET Framework 4, hence the PowerShell v3+ requirement.

Takes input $n, constructs a new array $f pre-populated with 1s, of length $n. Then we loop from 2..$n and each iteration simply construct the next Fibonacci value. Finally, we take $f from 0 up to $n and -join it together with * (so we have a big ol' string like 1*1*2*3*5*8*...), prepend that string with the cast "[bigint]", and pipe that to |iex (short for Invoke-Expression and similar to eval). The result is left on the pipeline, and output is implicit. We get by with only one data cast, as PowerShell uses the explicit cast from the left-hand-side of an operator as an implicit cast on the right-hand-side.

Tosses an array-index-out-of-bounds style exception to STDERR, but that's shorter than setting the loop to 2..($n-1) ;-)

If we didn't need to go higher than ~55, we can get rid of the cast and parens for the following at 73 bytes. Input values above 13 will result in scientific notation output.

```<code>param($n)$f=,1*$n;2..$n|%{$f[$_]=$f[$_-1]+$f[$_-2]};$f[0..$n]-join'*'|iex
</code>```

Title: Fibonacci-orial

Body:
PowerShell v3+, 86 bytes

param($n)$f=,1*$n;2..$n|%{$f[$_]=$f[$_-1]+$f[$_-2]};"[bigint]"+($f[0..$n]-join'*')|iex

The [bigint] data structure was introduced in .NET Framework 4, hence the PowerShell v3+ requirement.

Takes input $n, constructs a new array $f pre-populated with 1s, of length $n. Then we loop from 2..$n and each iteration simply construct the next Fibonacci value. Finally, we take $f from 0 up to $n and -join it together with * (so we have a big ol' string like 1*1*2*3*5*8*...), prepend that string with the cast "[bigint]", and pipe that to |iex (short for Invoke-Expression and similar to eval). The result is left on the pipeline, and output is implicit. We get by with only one data cast, as PowerShell uses the explicit cast from the left-hand-side of an operator as an implicit cast on the right-hand-side.

Tosses an array-index-out-of-bounds style exception to STDERR, but that's shorter than setting the loop to 2..($n-1) ;-)

If we didn't need to go higher than ~55, we can get rid of the cast and parens for the following at 73 bytes. Input values above 13 will result in scientific notation output.

param($n)$f=,1*$n;2..$n|%{$f[$_]=$f[$_-1]+$f[$_-2]};$f[0..$n]-join'*'|iex


问:
Is this number Loeschian?
A positive integer \$k\$ is a Loeschian number if

\$k\$ can be expressed as \$i^2 + j^2 + i\times j\$ for \$i\$, \$j\$ integers.

For example, the first positive Loeschian numbers are: \$1\$ (\$i=1, j=0\$); \$3\$ (\$i=j=1\$); \$4\$ (\$i=2, j=0\$); \$7\$ (\$i=2, j=1\$); \$9\$ (\$i=-3, j=3\$); ... Note that \$i, j\$ for a given \$k\$ are not unique. For example, \$9\$ can also be generated with \$i=3, j=0\$.

Other equivalent characterizations of these numbers are:

\$k\$ can be expressed as \$i^2 + j^2 + i\times j\$ for \$i, j\$ non-negative integers. (For each pair of integers \$i, j\$ there's a pair of non-negative integers that gives the same \$k\$)

There is a set of \$k\$ contiguous hexagons that forms a tesselation on a hexagonal grid so that corresponding cells are the same distance apart (see illustrations for \$k = 4\$ and for \$k = 7\$). (Because of this property, these numbers find application in mobile cellular communication networks.)

See more characterizations in the OEIS page of the sequence.

The challenge

Given a positive integer, output a truthy result if it is a Loeschian number, or a falsy result otherwise.

The program or function should handle (say in less than a minute) inputs up to \$1000\$, or up to data type limitations.

Code golf. Shortest wins.

Test cases

The following numbers should output a truthy result:

```<code>1, 4, 7, 12, 13, 108, 109, 192, 516, 999
</code>```

The following numbers should output a falsy result:

```<code>2, 5, 10, 42, 101, 102, 128, 150, 501, 1000
</code>```

答:
C, 66 bytes

Call f() with the number to test. The function returns the number of solutions it found.

```<code>q,r;f(n){for(r=q=0;q++<n*n;r+=n==q%n*(q%n+q/n)+q/n*q/n);return r;}
</code>```

Try it on ideone.

Title: Is this number Loeschian?

Body:
C, 66 bytes

Call f() with the number to test. The function returns the number of solutions it found.

q,r;f(n){for(r=q=0;q++<n*n;r+=n==q%n*(q%n+q/n)+q/n*q/n);return r;}

Try it on ideone.


答:
Pyke, 10 bytes

```<code>\=*"(:)-"+
</code>```

Try it here!

Or 8 bytes (noncompeting)

```<code>\=*"(:)-
</code>```

Try it here!

Title: Snakes all around

Body:
Pyke, 10 bytes

\=*"(:)-"+

Try it here!

Or 8 bytes (noncompeting)

\=*"(:)-

Try it here!


问:
Make a math equation from the date
In my Economics class, my friends and I like to come up with ways to rearrange the digits in the date (in MM/DD/YY) format to create a valid mathematical equation. For the most part, we are allowed to use addition, subtraction, multiplication, division, parentheses, and exponentiation in addition to concatenation.

Your program should do something similar. The program should import the current date and insert operators to print an expression according to the following rules.

The digits MUST be used in order. Rearrangement of digits is not allowed.

The resulting expression must be mathematically accurate.

Addition, subtraction, multiplication, division, exponentiation, and use of parentheses is allowed. So is concatenation of digits. However, not all operations are necessary. You cannot use a subtraction sign to make a digit negative (like -1+1+11=10 on November 11, 2010).

The program must run in 60 seconds on a standard machine.

For example, this challenge was written on November 10, 2015. The program would interpret this as 11/10/15. A sample output would be (1+1)/10=1/5.

Bonuses

You may multiply the number of bytes in your code by 0.9 for each one of the following your program supports.

The program prints all possible expressions that can be formed, separated by newlines. Multiply by an additional 0.95 if the expressions are listed in increasing order of additional symbols.

The program also works for MM/DD/YYYY dates, printing a possibility with the first two digits of the year in addition to the possibility without. If this bonus is combined with the first bonus, all possibilities with the first two digits of the year must be printed.

The program also prints an equation for when there are multiple equalities (for example, on November 11, 2011, 1=1=1=1=1=1 would be printed, in addition to possibilities such as 1*1=1=1=1=1, 1*1*1=1=1=1, and 1*1*1*1=1=1. All such cases must be printed for the first bonus to be achieved.

The program supports conversion to bases between 2 and 16. Note that if the base is not 10, all numbers in the expression must be written in the same base, and  (Base b) must be written after the expression (with b replaced accordingly).

This is code golf, so standard rules apply. Shortest code in bytes wins.

答:
Python 3, <s>424</s> <s>420</s> <s>369</s> 363 bytes

```<code>import time as t
r=range
x=len
d=list(t.strftime('%m%d%y'))
o=([[x,x+'(',x+')']for x in ['']+"+ - == * / **".split()])
n=[]
for l in o:
    n=l+n
o=n
for p in r(x(o)**(x(d)-1)):
    e=''
    for i in r(x(d)-1):
        e+=str(d[i])+o[(p//(x(o)**i))%x(o)]
    e+=str(d[-1])
    try:
        if eval(e)and e.find('=')!=-1:
            print(e.replace('==','=').replace('**','^'))
            break
    except:pass
</code>```

Brute-forces all possible combinations of operations in the numbers and stops when it finds one.

EDIT: Saved 4 bytes thanks to @NoOneIsHere

EDIT 2: Saved 51(!) bytes thanks to @ValueInk

Title: Make a math equation from the date

Body:
Python 3, <s>424</s> <s>420</s> <s>369</s> 363 bytes

import time as t
r=range
x=len
d=list(t.strftime('%m%d%y'))
o=([[x,x+'(',x+')']for x in ['']+"+ - == * / **".split()])
n=[]
for l in o:
    n=l+n
o=n
for p in r(x(o)**(x(d)-1)):
    e=''
    for i in r(x(d)-1):
        e+=str(d[i])+o[(p//(x(o)**i))%x(o)]
    e+=str(d[-1])
    try:
        if eval(e)and e.find('=')!=-1:
            print(e.replace('==','=').replace('**','^'))
            break
    except:pass

Brute-forces all possible combinations of operations in the numbers and stops when it finds one.

EDIT: Saved 4 bytes thanks to @NoOneIsHere

EDIT 2: Saved 51(!) bytes thanks to @ValueInk


答:
dc, <s>269</s> 237 bytes

```<code>299si[lid1-dsi3/li3>vdn[ bottle]P1<n]sm[[s]P]sn[ of beer]so[ on the wall]sp[, ]sq46sr10ss[[Take one down and pass it around]Pq]st[d4<t[Go to the store and buy some more]P]su[99+]sv[lmxloPlpPlqPlmxloPlrPlsPluxlqPlmxloPlpPlrPlsdPP3<z]dszx
</code>```

Shaved off about 30 bytes by replacing two counters w/ 1 299/3 counter; couple of unnecessary variable loads replaced w/ stack duplications; code point 46 instead of [.].

Title: "99 Bottles of Beer"

Body:
Write a program that outputs the lyrics to 99 Bottles of Beer, in as few bytes as possible.

Lyrics:

```<code>99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.

98 bottles of beer on the wall, 98 bottles of beer.
Take one down and pass it around, 97 bottles of beer on the wall.

97 bottles of beer on the wall, 97 bottles of beer.
Take one down and pass it around, 96 bottles of beer on the wall.

96 bottles of beer on the wall, 96 bottles of beer.
Take one down and pass it around, 95 bottles of beer on the wall.

95 bottles of beer on the wall, 95 bottles of beer.
Take one down and pass it around, 94 bottles of beer on the wall.

....

3 bottles of beer on the wall, 3 bottles of beer.
Take one down and pass it around, 2 bottles of beer on the wall.

2 bottles of beer on the wall, 2 bottles of beer.
Take one down and pass it around, 1 bottle of beer on the wall.

1 bottle of beer on the wall, 1 bottle of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.
</code>```

Rules:

Your program must log to STDOUT or an acceptable alternative, or be returned from a function (with or without a trailing newline).

Your program must be a full, runnable program or function.

Languages specifically written to submit a 0-byte answer to this challenge are allowed, just not particularly interesting.

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

This is different from the output by HQ9+ or 99. Any answers written in these languages will be deleted.

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

Catalogue

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

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

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

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

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

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

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

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

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

Body:
dc, <s>269</s> 237 bytes

299si[lid1-dsi3/li3>vdn[ bottle]P1<n]sm[[s]P]sn[ of beer]so[ on the wall]sp[, ]sq46sr10ss[[Take one down and pass it around]Pq]st[d4<t[Go to the store and buy some more]P]su[99+]sv[lmxloPlpPlqPlmxloPlrPlsPluxlqPlmxloPlpPlrPlsdPP3<z]dszx

Shaved off about 30 bytes by replacing two counters w/ 1 299/3 counter; couple of unnecessary variable loads replaced w/ stack duplications; code point 46 instead of [.].


问:
My Squiggly Lamp
While moving, I broke my lamp. Now, I need a new one. It's your job to make me a lamp! I'm not sure what size I want, though I know I want a squiggly one.

Your program/function must take in a number input, and print out a lamp with that many squiggles/bumps.

Examples:

Input:2

Output:

```
/--\
 ()
 ()
/__\
```

Input:3

Output:

```
/--\
 ()
 ()
 ()
/__\
```

Input:5

Output:

```
/--\
 ()
 ()
 ()
 ()
 ()
/__\
```

Rules:

0 & negative numbers don't matter

To give the lamps (an this challenge) more of a variety, you must change the lamp shade.

They must be 4 characters wide and 1 character high.

They can be in any shape, including non-lamp-shade shapes.

They must not contain whitespace.

The base must stay the same.

You must show an example input & output with your lamp shade.

Shortest code wins!

Title: My Squiggly Lamp

Body:
Pyke, 15 bytes

" ()"~mQAD"/__\

Try it here!

     ~m         - 1000
" ()"           -  " ()"
       QAD      - duplicate(^) input times
          "/__\ - "/__\"

Outputs:

1000
 ()
 ()
/__\


问:
Collatz Paths: Forwards and Backwards along the Collatz Conjecture
The Collatz conjecture is a very well-known conjecture. Take a positive integer; if it's even, divide by 2, else, multiply by 3 and add 1. Repeat until you reach 1 or something else happens. The conjecture is that this process always reaches 1.

You can also reverse the process. Start at 1, multiply by 2, and to branch to multiply by 3 and add 1 numbers, when you reach an even number that is 1 (mod 3), subtract 1 and divide by 3.

A Collatz path combines the two, trying to get from one number to another with those four operations.

For example, to get to 20 from 1:

```<code>1     *2
2     *2
4     *2
8     *2
16    *2
5     (-1)/3
10    *2
20    *2
</code>```

You can also get to 3 from 10 by subtracting 1 and dividing by 3.

With these tools, you can traverse a Collatz path from one number to another. For example, the path from 20 to 3 is (divide by 2), (subtract 1, divide by 3).

In short, the available operations are:

```<code>n * 2       always
n // 2      if n % 2 == 0
n * 3 + 1   if n % 2 == 1
(n-1) // 3  if n % 6 == 4
</code>```

Note: not all Collatz paths are short. a(7,3) could run

```<code>7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 2, 4, 8, 16, 5, 10, 3
</code>```

but a shorter path is

```<code>7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 3
</code>```

The Challenge

Find the length of the shortest Collatz path between any two positive integers, p and q.

Input is any two positive integers less than 2^20 to avoid integer overflow. The input method is left to the discretion of the golfer. The integers may be the same, in which case, the length of the Collatz path is 0.

Output should be one integer, denoting the length of the shortest Collatz path between p and q.

Test Cases

```<code>a(2,1)
1

a(4,1)
1         # 4 -> 1

a(3,1)
6         # 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 1

a(11,12)
11        # 11 -> 34 -> 17 -> 52 -> 26 -> 13
          # -> 40 -> 20 -> 10 -> 3 -> 6 -> 12

a(15,9)
20        # 46 -> 23 -> 70 -> 35 -> 106 -> 53 -> 160 -> 80 -> 40 -> 13
          # -> 26 -> 52 -> 17 -> 34 -> 11 -> 22 ->  7 -> 14 -> 28 -> 9
</code>```

Many thanks to orlp for their help in clarifying this challenge.

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

答:
Python 2, 80 bytes

p=lambda n:n-2and{n}|p([n/2,n*3+1][n%2])or{n}
lambda m,n:m*n==2or len(p(m)^p(n))
```

Take the length of the symmetric difference of the two forward Collatz sequences starting at the two input numbers and ending at 2. The only exception is if the input is 1, 2 or 2, 1, which we special-case.

Body:
Python 2, 80 bytes

p=lambda n:n-2and{n}|p([n/2,n*3+1][n%2])or{n}
lambda m,n:m*n==2or len(p(m)^p(n))

Take the length of the symmetric difference of the two forward Collatz sequences starting at the two input numbers and ending at 2. The only exception is if the input is 1, 2 or 2, 1, which we special-case.


答:
APL, 15 bytes

```<code>{⍵='*':∇¨⍞⋄⍬}¨⍞
</code>```

Test:

```<code>      {⍵='*':∇¨⍞⋄⍬}¨⍞
*
*
**
hi
**
hi
hi
⍝ termination
</code>```

Explanation:

```<code>              ⍞  read a line from the keyboard
{           }¨   for each character:
 ⍵='*':          if it is *:
         ⍞         read another line from the keyboard
       ∇¨          do the same for each character
          ⋄⍬     otherwise, return empty list (which displays as nothing)
</code>```

Title: Golf an InterpretMe interpreter

Body:
APL, 15 bytes

{⍵='*':∇¨⍞⋄⍬}¨⍞

Test:

      {⍵='*':∇¨⍞⋄⍬}¨⍞
*
*
**
hi
**
hi
hi
⍝ termination

Explanation:

              ⍞  read a line from the keyboard
{           }¨   for each character:
 ⍵='*':          if it is *:
         ⍞         read another line from the keyboard
       ∇¨          do the same for each character
          ⋄⍬     otherwise, return empty list (which displays as nothing)


答:
Lua 36 bytes

```<code>print((("*"):rep(10).."\n"):rep(10))
</code>```

There is already a Lua answer, but his was however not a full program that would print output and this one is shorter.

I wanted to post it as a comment to that one, but I don't have the reputation yet.

Title: Print a 10 by 10 grid of asterisks

Body:
Background

This is a standard textbook example to demonstrate for loops.

This is one of the first programs I learnt when I started learning programming ~10 years ago.

Task

You are to print this exact text:

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

Specs

You may have extra trailing newlines.

You may have extra trailing spaces (U+0020) at the end of each line, including the extra trailing newlines.

Scoring

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

Body:
Lua 36 bytes

print((("*"):rep(10).."\n"):rep(10))

There is already a Lua answer, but his was however not a full program that would print output and this one is shorter.

I wanted to post it as a comment to that one, but I don't have the reputation yet.


问:
Compute the Fibonomial Coefficient

Background

The Fibonacci sequence is defined as

$$f(1) = 1 \\ f(2) = 1 \\ f(n) = f(n-1) + f(n-2)$$

The Fibonorial, similar to the factorial, is the product of the first \$n\$ Fibonacci numbers.

$$g(n) = f(1) \times f(2) \times ... \times f(n-1) \times f(n)$$

The Fibonomial coefficient, similar to the binomial coefficient is defined as

$$\begin{align}a(n, 0) & = 1 \\
a(n, k) & = \frac {g(n)} {g(n-k) \times g(k)} \\
& = \frac {f(n) \times f(n-1) \times ... \times f(n-k+1)} {f(1) \times f(2) \times ... \times f(k)}
\end{align}$$

Task

Your goal is to create a function or program to compute the Fibonomial coefficient given two non-negative integers \$n\$ and \$k\$ with \$l \le n\$.

Test Cases

```<code>a(0, 0) = 1
a(1, 1) = 1
a(2, 0) = 1
a(3, 2) = 2
a(8, 3) = 1092
a(11, 5) = 1514513
a(22, 7) = 7158243695757340957617
a(25, 3) = 49845401197200
a(50, 2) = 97905340104793732225
a(100, 1) = 354224848179261915075
</code>```

Rules

This is code-golf so the shortest code wins.

Builtins are allowed.

Related

A000045 - Challenge - Fibonacci Sequence

A003266 - Challenge - Fibonorial

A010048 - Fibonomial coefficient

答:
MATL, <s>25</s> 23 bytes

```<code>1ti2-:"yy+]vtPi:)w5M)/p
</code>```

Try it online!

Explanation

```<code>1t      % Push 1 twice
i2-:    % Take input n. Generate vector [1 2 ... n-2]
"       % Repeat n-2 times
  yy    %   Push the top two elements again
  +     %   Add them
]       % End
v       % Concatenate into column vector of first n Fibonacci numbers
tP      % Duplicate and reverse
i:      % Take input k. Generate vector [1 2 ... k]
)       % Apply index to get last k Fibonacci numbers
w       % Swap to move vector of first n Fibonacci numbers to top
5M      % Push [1 2 ... k] again
)       % Apply index to get first k Fibonacci numbers
/       % Divide element-wise
p       % Product of vector. Implicitly display
</code>```

Title: Compute the Fibonomial Coefficient

Body:
MATL, <s>25</s> 23 bytes

1ti2-:"yy+]vtPi:)w5M)/p

Try it online!

Explanation

1t      % Push 1 twice
i2-:    % Take input n. Generate vector [1 2 ... n-2]
"       % Repeat n-2 times
  yy    %   Push the top two elements again
  +     %   Add them
]       % End
v       % Concatenate into column vector of first n Fibonacci numbers
tP      % Duplicate and reverse
i:      % Take input k. Generate vector [1 2 ... k]
)       % Apply index to get last k Fibonacci numbers
w       % Swap to move vector of first n Fibonacci numbers to top
5M      % Push [1 2 ... k] again
)       % Apply index to get first k Fibonacci numbers
/       % Divide element-wise
p       % Product of vector. Implicitly display


问:
A square of text

The Challenge

Given a string, output the text in the shape of a square.

You can assume that the text will always fit in a square, and that it will never be an empty string.

You can also assume it will never have newlines.

Example

```<code>Input:
Hi, world

Output:
Hi,
 wo
rld
</code>```

Test Cases

```<code>Input:
Hi, world! Hello

Output:
Hi,
worl
d! H
ello

Input:
Lorem ipsum dolor sit amt

Output:
Lorem
 ipsu
m dol
or si
t amt

Input:
H

Output:
H
</code>```

Rules

This is code-golf, so shortest answer in bytes wins! Tiebreaker is most upvoted answer.

Standard loopholes are forbidden.

答:
Python, <s>94</s> <s>75</s> <s>71</s> <s>65</s> 63 bytes

```<code>import re;lambda r:"\n".join(re.findall("."*int(len(r)**.5),r))
</code>```

Old version:

```<code>lambda r:"\n".join(map("".join,zip(*[iter(r)]*int(len(r)**.5))))
</code>```

Title: A square of text

Body:
Python, <s>94</s> <s>75</s> <s>71</s> <s>65</s> 63 bytes

import re;lambda r:"\n".join(re.findall("."*int(len(r)**.5),r))

Old version:

lambda r:"\n".join(map("".join,zip(*[iter(r)]*int(len(r)**.5))))


答:
Jelly, <s>8</s> 7 bytes

```<code>sLÆ½$j⁷
</code>```

Saved a byte thanks to @Dennis.

Try it online.

Explanation

```<code>sLÆ½$j⁷  Input: string S
    $    Monadic chain
 L         Get the length of S
  Æ½       Take the integer square root of it, call it n
s        Split S into chunks of size n
     j⁷  Join using newline
</code>```

Title: A square of text

Body:
The Challenge

Given a string, output the text in the shape of a square.

You can assume that the text will always fit in a square, and that it will never be an empty string.

You can also assume it will never have newlines.

Example

```<code>Input:
Hi, world

Output:
Hi,
 wo
rld
</code>```

Test Cases

```<code>Input:
Hi, world! Hello

Output:
Hi,
worl
d! H
ello

Input:
Lorem ipsum dolor sit amt

Output:
Lorem
 ipsu
m dol
or si
t amt

Input:
H

Output:
H
</code>```

Rules

This is code-golf, so shortest answer in bytes wins! Tiebreaker is most upvoted answer.

Standard loopholes are forbidden.

Body:
Jelly, <s>8</s> 7 bytes

sLÆ½$j⁷

Saved a byte thanks to @Dennis.

Try it online.

Explanation

sLÆ½$j⁷  Input: string S
    $    Monadic chain
 L         Get the length of S
  Æ½       Take the integer square root of it, call it n
s        Split S into chunks of size n
     j⁷  Join using newline


答:
Perl, 23 + 4 (-pF flags) = 27 bytes

-2 bytes thanks to @DomHastings

-1 bytes thanks to @DomHastings

$==sqrt@F;s/.{$=}/$&
/g
```

Try it online!

Expanations : computes the square root (lets call it S for the explanation) of the size of the input (it will be always be an integer) (@F is used in scalar context, thus returning its size), then add a newline after each bloc of S characters.

Title: A square of text

Body:
Perl, 23 + 4 (-pF flags) = 27 bytes

-2 bytes thanks to @DomHastings

-1 bytes thanks to @DomHastings

$==sqrt@F;s/.{$=}/$&
/g

Try it online!

Expanations : computes the square root (lets call it S for the explanation) of the size of the input (it will be always be an integer) (@F is used in scalar context, thus returning its size), then add a newline after each bloc of S characters.


问:
Bijection between binary strings and pairs thereof
Input: Either one or two strings consisting of '0's and '1's.  If there are 2, they are separated by a space. All strings are of length at least 1.

Output:

If a single input was given as input,  2 are output.

If 2 were input, 1 is output.

The output strings can be whatever you like, but if running your program with input A gives you B, then running it with B must give A (if inputting 111 11 gives 00000, then inputting 00000 must give 111 11).

That means if you pipe your program to itself, you should get back whatever you input.  If your program is called foo, you can test that like this:

```<code>>echo 101 101|foo|foo
101 101
</code>```

To prevent the use of brute force techniques, your code should be able to run with 1000 digit strings in under 10 seconds.  My Python solution for this takes less than 1 second on 10000 digit strings so this shouldn't be a problem.

Shortest code wins.

Body:
Python, 326

s=lambda i,l:bin(i)[2:].zfill(l)
f=lambda n:2**n*(n-3)+4
g=lambda n:2**n-2
i=raw_input()
if' 'in i:
 a,b=i.split();n=len(a+b);r=f(n)+int(a+b,2)*(n-1)+len(a)-1;l=1
 while g(l+1)<=r:l+=1
 print s(r-g(l),l)
else:
 n=len(i);r=g(n)+int(i,2);l=2
 while f(l+1)<=r:l+=1
 r-=f(l);p=r%(l-1)+1;w=s(r/(l-1),l);print w[:p],w[p:]

Example inputs/outputs:

     input | output
-----------+-----------
         0 | 0 0
       0 0 | 0
     10 10 | 10101
     10101 | 10 10
0000000000 | 101 0100
  101 0100 | 0000000000


答:
Haskell, <s>77 57 55 52</s> 50 bytes

The first line is originally coming from the Fibonacci function or sequence challenge and was written by @Anon.

The second line was added in the Fibonacci-orial challenge by @ChristianSievers.

Now I added the third line. How much further will those challenges go?=)

```<code>f=1:scanl(+)1f
g=(scanl(*)1f!!)
n#k=g n/g(n-k)/g k
</code>```

Thanks for 5 bytes @xnor!

Title: Compute the Fibonomial Coefficient

Body:
Background

The Fibonacci sequence is defined as

$$f(1) = 1 \\ f(2) = 1 \\ f(n) = f(n-1) + f(n-2)$$

The Fibonorial, similar to the factorial, is the product of the first \$n\$ Fibonacci numbers.

$$g(n) = f(1) \times f(2) \times ... \times f(n-1) \times f(n)$$

The Fibonomial coefficient, similar to the binomial coefficient is defined as

$$\begin{align}a(n, 0) & = 1 \\
a(n, k) & = \frac {g(n)} {g(n-k) \times g(k)} \\
& = \frac {f(n) \times f(n-1) \times ... \times f(n-k+1)} {f(1) \times f(2) \times ... \times f(k)}
\end{align}$$

Task

Your goal is to create a function or program to compute the Fibonomial coefficient given two non-negative integers \$n\$ and \$k\$ with \$l \le n\$.

Test Cases

```<code>a(0, 0) = 1
a(1, 1) = 1
a(2, 0) = 1
a(3, 2) = 2
a(8, 3) = 1092
a(11, 5) = 1514513
a(22, 7) = 7158243695757340957617
a(25, 3) = 49845401197200
a(50, 2) = 97905340104793732225
a(100, 1) = 354224848179261915075
</code>```

Rules

This is code-golf so the shortest code wins.

Builtins are allowed.

Related

A000045 - Challenge - Fibonacci Sequence

A003266 - Challenge - Fibonorial

A010048 - Fibonomial coefficient

Body:
Haskell, <s>77 57 55 52</s> 50 bytes

The first line is originally coming from the Fibonacci function or sequence challenge and was written by @Anon.

The second line was added in the Fibonacci-orial challenge by @ChristianSievers.

Now I added the third line. How much further will those challenges go?=)

f=1:scanl(+)1f
g=(scanl(*)1f!!)
n#k=g n/g(n-k)/g k

Thanks for 5 bytes @xnor!


答:
Python 67 bytes

```<code>f=lambda n,a=1,b=1:n<1or a*f(n-1,b,a+b)
lambda n,k:f(n)/f(k)/f(n-k)
</code>```

Call using a(n,k). Uses @Dennis fibonorial answer (is that allowed?), and a straightforward implementation of the question otherwise.

Title: Compute the Fibonomial Coefficient

Body:
Python 67 bytes

f=lambda n,a=1,b=1:n<1or a*f(n-1,b,a+b)
lambda n,k:f(n)/f(k)/f(n-k)

Call using a(n,k). Uses @Dennis fibonorial answer (is that allowed?), and a straightforward implementation of the question otherwise.


答:
Python 2, 55 bytes

s=input()
n=int(len(s)**.5)
while s:print s[:n];s=s[n:]
```

Title: A square of text


答:
MATL, 6 bytes

```<code>tnX^e!
</code>```

Try it online!

Explanation

```<code>t     % Take input implicitly. Push another copy
n     % Get number of elements of the copy
X^    % Take square root
e     % Reshape the input into that number of rows, in column-major order
      % (which means: down, then across)
!     % Transpose so that text reads horizontally. Implicitly display
</code>```

Title: A square of text

Body:
MATL, 6 bytes

tnX^e!

Try it online!

Explanation

t     % Take input implicitly. Push another copy
n     % Get number of elements of the copy
X^    % Take square root
e     % Reshape the input into that number of rows, in column-major order
      % (which means: down, then across)
!     % Transpose so that text reads horizontally. Implicitly display


答:
CJam, 8 bytes

```<code>l_,mQ/N*
</code>```

Try it online!

Explanation

```<code>l     e# Read line from input
_,    e# Duplicate. Get length
mQ    e# Integer square root
/     e# Split into pieces of that size
N*    e# Join by newline. Implicitly display
</code>```

Title: A square of text

Body:
CJam, 8 bytes

l_,mQ/N*

Try it online!

Explanation

l     e# Read line from input
_,    e# Duplicate. Get length
mQ    e# Integer square root
/     e# Split into pieces of that size
N*    e# Join by newline. Implicitly display


答:
Convex, 7 bytes

```<code>_,mQ/N*
</code>```

Try it online!

Fun fact:

_,mQ/\* also works on TIO due to how it works.

How have I forgotten to make a 1-char square root op?

Title: A square of text

Body:
Convex, 7 bytes

_,mQ/N*

Try it online!

Fun fact:

_,mQ/\* also works on TIO due to how it works.

How have I forgotten to make a 1-char square root op?


答:
Haskell, 46 bytes

l=0:scanl(+)1l;a%0=1;a%b=(a-1)%(b-1)*l!!a/l!!b
```

Outputs floats. Generates the infinite Fibonacci list. Then, does the binomial recusion, multiplying and dividing by elements from the Fibonacci list.

Title: Compute the Fibonomial Coefficient

Body:
Haskell, 46 bytes

l=0:scanl(+)1l;a%0=1;a%b=(a-1)%(b-1)*l!!a/l!!b

Outputs floats. Generates the infinite Fibonacci list. Then, does the binomial recusion, multiplying and dividing by elements from the Fibonacci list.


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

Thanks to @quartata for letting me know about the square-root function

```<code>Dgtô¶ý
</code>```

Try it online!

Explanation

```<code>D     Implicit input. Duplicate
g     Number of elements
t     Square root
ô     Split into chunks of that length
¶     Push newline character
ý     Join list by newlines. Implicit display
</code>```

Title: A square of text

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

Thanks to @quartata for letting me know about the square-root function

Dgtô¶ý

Try it online!

Explanation

D     Implicit input. Duplicate
g     Number of elements
t     Square root
ô     Split into chunks of that length
¶     Push newline character
ý     Join list by newlines. Implicit display


答:
05AB1E, 5 bytes

```<code>Dgtô«
</code>```

Try it online!

```<code>D    duplicate a (implicit input)
g    length of a
t    square root of a
ô    push a split in pieces of b
«    join by newlines (implicit output)
</code>```

Title: A square of text

Body:
05AB1E, 5 bytes

Dgtô«

Try it online!

D    duplicate a (implicit input)
g    length of a
t    square root of a
ô    push a split in pieces of b
«    join by newlines (implicit output)


答:
Vim, <s>59, 57</s>, 48 bytes/keystrokes

```<code>$:let @q=float2nr(sqrt(col('.')))."|li<C-v><cr><C-v><esc>@q"<cr>@q
</code>```

Since V is backwards compatible, you can Try it online!

I randomly received an upvote on this answer, so I looked over it again. My vim-golfing skills have greatly increased over the last 7 months, so I saw that this answer was very poorly golfed. This one is much better.

Title: A square of text

Body:
Vim, <s>59, 57</s>, 48 bytes/keystrokes

$:let @q=float2nr(sqrt(col('.')))."|li<C-v><cr><C-v><esc>@q"<cr>@q

Since V is backwards compatible, you can Try it online!

I randomly received an upvote on this answer, so I looked over it again. My vim-golfing skills have greatly increased over the last 7 months, so I saw that this answer was very poorly golfed. This one is much better.


答:
Pyth, 8 bytes

```<code>jcs@lQ2Q
</code>```

Try it online

How it works

```<code>    lQ     length of input
   @  2    square root
  s        floor
 c     Q   chop input into that many equal pieces
j          join on newline
</code>```

Title: A square of text

Body:
Pyth, 8 bytes

jcs@lQ2Q

Try it online

How it works

    lQ     length of input
   @  2    square root
  s        floor
 c     Q   chop input into that many equal pieces
j          join on newline