问:
Can you outgolf me? (Robbers section)

Robbers section

The cops section can be found here.

Challenge

Your task is to outgolf the submissions of the cops in the same language and the same version (for example, Python 3.5 ≠ Python 3.4, so that is not allowed). A submission is outgolfed when the length in bytes is shorter than the original submission. You only need to golf off at least 1 byte in order to crack a submission. E.g. if the task was to perform 2 × n, and the submission was the following:

```<code>print(2*input())
</code>```

You could outgolf the cop by doing the following:

```<code>print 2*input()
</code>```

Or even this (since lambda's are allowed):

```<code>lambda x:2*x
</code>```

Post this with the following header:

```<code>##{language name}, <s>{prev byte count}</s> {byte count}, {cop's submission + link}
</code>```

For example:

Python 2, <s>16</s> 12 bytes, Adnan (+ link to submission)

```<code>lambda x:2*x
</code>```

Computes A005843, (offset = 0).

In that case, you have cracked the submission.

Scoring

The person with who cracked the most submissions is the winner.

Rules

The crack submission must be in the same language as the cop submission.

The same input should result into the same output (so a(2) = 4 should remain 4).

For languages such as Python, you can import libraries that are standard included within the language. (So, no numpy/sympy etc.)

Input and output are both in decimal (base 10).

Note

This challenge is finished. The winner of the Robbers section is feersum. The final scores for the CnR are shown below:

feersum: 16 cracks

Dennis: 12 cracks

Leaky Nun: 6 cracks

Lynn: 4 cracks

miles: 3 cracks

Martin Ender: 2 cracks

Emigna: 2 cracks

jimmy23013: 1 crack

Sp3000: 1 crack

randomra: 1 crack

alephalpha: 1 crack

nimi: 1 crack

Destructible Watermelon: 1 crack

Dom Hastings: 1 crack

答:
Sesos, <s>14</s> 11 bytes, Leaky Nun

Computes n2. Try it here.

Hex dump:

```<code>0000000: 16c0f7 959d9b 26e83e ce3d                         ......&.>.=
</code>```

From assembly:

```<code>set numin
set numout
get
jmp
  jmp, sub 1, fwd 1, add 1, fwd 1, add 2, rwd 2, jnz
  fwd 2, sub 1
  rwd 1, sub 1
  jmp, sub 1, rwd 1, add 1, fwd 1, jnz
  rwd 1
jnz
fwd 2
put
</code>```

Title: Can you outgolf me? (Robbers section)

Body:
Sesos, <s>14</s> 11 bytes, Leaky Nun

Computes n2. Try it here.

Hex dump:

0000000: 16c0f7 959d9b 26e83e ce3d                         ......&.>.=

From assembly:

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


问:
Print custom alphabet

The Challenge

Display the alphabet from a given letter read from console input. If the letter is uppercase, you have to display the alphabet uppercased. The alphabet printed must end in the precedent letter of the one inserted. If an additiontal parameter is added to the input (a simple dot .) the alphabet should be printed one letter in each line. Otherwise, the alphabet should be printed in the same line, separed by a simple space. If wrong input is send to the program it will not print anything.

Inputs examples:

Input:

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

Program's ouput:

```<code>d e f g h i j k l m n o p q r s t u v w x y z a b
</code>```

Input

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

Program's ouput:

```<code>I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
A
B
C
D
E
F
G
</code>```

ContentLicense: CC BY-SA 3.0

Title: Print custom alphabet

Body:
brainfuck, 303

,>,>++++++[-<-------->]<++[[-]+++++[->++++<]>++<]>++++++++++<<[->+>>>+<<<<]>>>>>>+++++++++++++++[-<++++++<<++++++>>>]<[<[->>]>[>>]<<-]<[[-]++++++++[-<++++>]]<<<[->>>+>+<<<<]>>>>>+[[-]<.<<<.>[->>>+>+<<<<]>>>[-<<<+>>>]<[->+>-<<]>[-<+>]+>[-<[-]>]<[++++[-<----->]<->]<+[->+>+<<]<[->+>-<<]>[-<+>]>>[-<<+>>]<]

Currently it doesn't support the If wrong input is send to the program it will not print anything part, and it can probably be shorter. I plan on fixing it later.  Right now my brain is too ****ed to continue.


问:
A Formula for Congruences
The Chinese Remainder Theorem can be quite useful in modular arithmetic.

For example, consider the following set of congruence relations:

For sets of congruence relations like this, where all the bases (3, 5, 7 in this example) are co-prime with each other, there will be one and only one integer n between 1 and the product of the bases (3*5*7 = 105 in this example) inclusive that satisfies the relations.

In this example, the number would be 14, generated by this formula:

where 2, 4, and 0 are given from the above example.

70, 21, 15 are the coefficients of the formula and they are dependent on the bases, 3, 5, 7.

To calculate the coefficients of the formula (70, 21, 15 in our example) for a set of bases, we use the following procedure.

For each number a in a set of bases:

Find the product of all of the other bases, denoted as P.

Find the first multiple of P that leaves a remainder of 1 when divided by a. This is the coefficient of a.

For example, to calculate the coefficient that corresponds to the base 3, we find the product of all the other bases (i.e. 5*7 = 35) and then find the first multiple of that product that leaves a remainder of 1 when divided by the base.

In this case, 35 leaves a remainder of 2 when divided by 3, but 35*2 = 70 leaves a remainder of 1 when divided by 3, so 70 is the corresponding coefficient for 3. Similarly, 3*7 = 21 leaves a remainder of 1 when divided by 5 and 3*5 = 15 leaves a remainder of 1 when divided by 7.

In a nutshell

For each number a in a set of numbers:

Find the product of all of the other numbers, denoted as P.

Find the first multiple of P that leaves a remainder of 1 when divided by a. This is the coefficient of a.

The challenge

The challenge is, for a set of two or more bases, to find the set of corresponding coefficients.

The set of bases are guaranteed to be pairwise co-prime and each base is guaranteed to be larger than 1.

Your input is a list of integers as input [3,4,5] or space-separated string "3 4 5" or however your inputs work.

Your output should either be a list of integers or space-separated string that denotes the set of coefficients.

Test cases

```<code>input             output
[3,5,7]           [70,21,15]
[2,3,5]           [15,10,6]
[3,4,5]           [40,45,36]
[3,4]             [4,9]
[2,3,5,7]         [105,70,126,120]
[40,27,11]        [9801,7480,6480]
[100,27,31]       [61101,49600,56700]
[16,27,25,49,11]  [363825,2371600,2794176,5583600,529200]
</code>```

Many thanks to Leaky Nun for his help in writing this challenge. As always, if the problem is unclear, please let me know. Good luck and good golfing!

答:
JavaScript (ES6), 80 bytes

```<code>a.map(e=>[...Array(e).keys()].find(i=>p*i/e%e==1)*p/e,p=a.reduce((i,j)=>i*j))
</code>```

I tried the extended Euclidean algorithm but it takes 98 bytes:

```<code>a=>a.map(e=>(r(e,p/e)+e)%e*p/e,p=a.reduce((i,j)=>i*j),r=(a,b,o=0,l=1)=>b?r(b,a%b,t,o-l*(a/b|0)):o)
</code>```

If the values are all prime, ES7 can do it in 56 bytes:

```<code>a=>a.map(e=>(p/e%e)**(e-2)%e*p/e,p=a.reduce((i,j)=>i*j))
</code>```

Title: A Formula for Congruences

Body:
JavaScript (ES6), 80 bytes

a.map(e=>[...Array(e).keys()].find(i=>p*i/e%e==1)*p/e,p=a.reduce((i,j)=>i*j))

I tried the extended Euclidean algorithm but it takes 98 bytes:

a=>a.map(e=>(r(e,p/e)+e)%e*p/e,p=a.reduce((i,j)=>i*j),r=(a,b,o=0,l=1)=>b?r(b,a%b,t,o-l*(a/b|0)):o)

If the values are all prime, ES7 can do it in 56 bytes:

a=>a.map(e=>(p/e%e)**(e-2)%e*p/e,p=a.reduce((i,j)=>i*j))


问:
Can you outgolf me? (Cops section)

Cops section

The robbers section can be found here.

Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions.

Challenge

Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (e.g. Python 3.5 ≠ Python 3.4, so that is not allowed), and when given n (using STDIN/function arguments/etc.), compute a(n) where a is an OEIS sequence of your choice. One of those programs is shorter than the other. You only need to submit the longer program of the two. The other one needs to be saved in case of not being cracked after 7 days. Your submission is cracked when your program has been outgolfed (whether it is by 1 byte or more).

For example, if the task you chose was to perform 2 × n, this could be a valid submission (in Python 2):

Python 2, 16 bytes, score = 15 / 16 = 0.9375

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

If your submission has been cracked, then you need to state that in your header like so:

Python 2, 16 bytes, score = 15 / 16 = 0.9375, [cracked] + link

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

Offset

This can be found on every OEIS page. For example, for A005843, the offset is 0,2. We only need to use the first one, which is 0. This means that the function is defined for all numbers ≥ 0.

In other words, the function OEIS(n) starts with n = 0. Your program needs to work for all cases given by OEIS.

More information can be found here.

Scoring

The score you get for your submission is equal to the following formula:

Score = Length (in bytes) of secret code ÷ Length (in bytes) of public code

The example above has the score 15 ÷ 16 = 0.9375.

The submission with the lowest score wins. Only submissions that have posted their solution will be eligible for winning.

Rules

The task you need to do is an OEIS sequence of your choice.

Given n, output OEIS(n). Deviation is not allowed, so you need to produce the exact same sequence (when given n, you need to output OEIS(n)).

Submissions that are not cracked within a period of 7 days are considered safe after the solution has been posted (submissions older than 7 days that do not have their solution posted are still vulnerable in being cracked).

In your submission, you need to post the following things: language name, byte count, full code, so no pastebin links etc. (to prevent answers like Unary), OEIS sequence, score with lengths of both programs and additionally, the encoding that is used.

Note: the same sequence cannot be posted twice in the same language. (For example, if the sequence A005843 has been done in Pyth, you cannot use Pyth again for that same sequence.)

Input and output are both in decimal (base 10)

Leaderboard

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

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Note

This challenge is finished. The final winner is feersum with his Seed answer. Congratulations! :).

You can still submit new cops, but be aware that they are no longer competing.

Title: Can you outgolf me? (Cops section)

Body:
Sesos, 14 bytes, score =  0.6429 (9/14) (cracked)

0000000: aed40b b47bc2 8e01be 8e9ddb b107                  ....{.........

Computes A130909.

Try it online!


答:
Sesos, <s>14</s> 9 bytes, Leaky Nun

Computes n mod 16. Try it here.

Hex:

```<code>0000000: 17f84a 750e4a 7d9d0f                              ..Ju.J}..
</code>```

Assembly:

```<code>set numin
set numout
set mask
get
jmp, sub 1, fwd 1, add 16, rwd 1, jnz
fwd 1
jmp, sub 16, fwd 1, add 1, rwd 1, jnz
fwd 1
put
</code>```

Title: Can you outgolf me? (Robbers section)

Body:
Robbers section

The cops section can be found here.

Challenge

Your task is to outgolf the submissions of the cops in the same language and the same version (for example, Python 3.5 ≠ Python 3.4, so that is not allowed). A submission is outgolfed when the length in bytes is shorter than the original submission. You only need to golf off at least 1 byte in order to crack a submission. E.g. if the task was to perform 2 × n, and the submission was the following:

```<code>print(2*input())
</code>```

You could outgolf the cop by doing the following:

```<code>print 2*input()
</code>```

Or even this (since lambda's are allowed):

```<code>lambda x:2*x
</code>```

Post this with the following header:

```<code>##{language name}, <s>{prev byte count}</s> {byte count}, {cop's submission + link}
</code>```

For example:

Python 2, <s>16</s> 12 bytes, Adnan (+ link to submission)

```<code>lambda x:2*x
</code>```

Computes A005843, (offset = 0).

In that case, you have cracked the submission.

Scoring

The person with who cracked the most submissions is the winner.

Rules

The crack submission must be in the same language as the cop submission.

The same input should result into the same output (so a(2) = 4 should remain 4).

For languages such as Python, you can import libraries that are standard included within the language. (So, no numpy/sympy etc.)

Input and output are both in decimal (base 10).

Note

This challenge is finished. The winner of the Robbers section is feersum. The final scores for the CnR are shown below:

feersum: 16 cracks

Dennis: 12 cracks

Leaky Nun: 6 cracks

Lynn: 4 cracks

miles: 3 cracks

Martin Ender: 2 cracks

Emigna: 2 cracks

jimmy23013: 1 crack

Sp3000: 1 crack

randomra: 1 crack

alephalpha: 1 crack

nimi: 1 crack

Destructible Watermelon: 1 crack

Dom Hastings: 1 crack

Body:
Sesos, <s>14</s> 9 bytes, Leaky Nun

Computes n mod 16. Try it here.

Hex:

0000000: 17f84a 750e4a 7d9d0f                              ..Ju.J}..

Assembly:

set numin
set numout
set mask
get
jmp, sub 1, fwd 1, add 16, rwd 1, jnz
fwd 1
jmp, sub 16, fwd 1, add 1, rwd 1, jnz
fwd 1
put


答:
GAP, 51 bytes

GAP has a function that can compute the motivating example with ChineseRem([2,5,7],[2,4,0]), but that still doesn't make it that easy to get the coefficients. We can get the n-th coefficient by using the list with a one in the n-th position and zeroes at the other positions as second argument. So we need to create these lists and apply the function to all of them:

```<code>l->List(Basis(Integers^Size(l)),b->ChineseRem(l,b))
</code>```

Title: A Formula for Congruences

Body:
The Chinese Remainder Theorem can be quite useful in modular arithmetic.

For example, consider the following set of congruence relations:

For sets of congruence relations like this, where all the bases (3, 5, 7 in this example) are co-prime with each other, there will be one and only one integer n between 1 and the product of the bases (3*5*7 = 105 in this example) inclusive that satisfies the relations.

In this example, the number would be 14, generated by this formula:

where 2, 4, and 0 are given from the above example.

70, 21, 15 are the coefficients of the formula and they are dependent on the bases, 3, 5, 7.

To calculate the coefficients of the formula (70, 21, 15 in our example) for a set of bases, we use the following procedure.

For each number a in a set of bases:

Find the product of all of the other bases, denoted as P.

Find the first multiple of P that leaves a remainder of 1 when divided by a. This is the coefficient of a.

For example, to calculate the coefficient that corresponds to the base 3, we find the product of all the other bases (i.e. 5*7 = 35) and then find the first multiple of that product that leaves a remainder of 1 when divided by the base.

In this case, 35 leaves a remainder of 2 when divided by 3, but 35*2 = 70 leaves a remainder of 1 when divided by 3, so 70 is the corresponding coefficient for 3. Similarly, 3*7 = 21 leaves a remainder of 1 when divided by 5 and 3*5 = 15 leaves a remainder of 1 when divided by 7.

In a nutshell

For each number a in a set of numbers:

Find the product of all of the other numbers, denoted as P.

Find the first multiple of P that leaves a remainder of 1 when divided by a. This is the coefficient of a.

The challenge

The challenge is, for a set of two or more bases, to find the set of corresponding coefficients.

The set of bases are guaranteed to be pairwise co-prime and each base is guaranteed to be larger than 1.

Your input is a list of integers as input [3,4,5] or space-separated string "3 4 5" or however your inputs work.

Your output should either be a list of integers or space-separated string that denotes the set of coefficients.

Test cases

```<code>input             output
[3,5,7]           [70,21,15]
[2,3,5]           [15,10,6]
[3,4,5]           [40,45,36]
[3,4]             [4,9]
[2,3,5,7]         [105,70,126,120]
[40,27,11]        [9801,7480,6480]
[100,27,31]       [61101,49600,56700]
[16,27,25,49,11]  [363825,2371600,2794176,5583600,529200]
</code>```

Many thanks to Leaky Nun for his help in writing this challenge. As always, if the problem is unclear, please let me know. Good luck and good golfing!

Body:
GAP, 51 bytes

GAP has a function that can compute the motivating example with ChineseRem([2,5,7],[2,4,0]), but that still doesn't make it that easy to get the coefficients. We can get the n-th coefficient by using the list with a one in the n-th position and zeroes at the other positions as second argument. So we need to create these lists and apply the function to all of them:

l->List(Basis(Integers^Size(l)),b->ChineseRem(l,b))


答:
Python, 39 bytes, 26/39=2/3=0.666 cont. points, cracked

```<code>s=lambda x:x+s(x-1)if x==1else x+s(x-1)
</code>```

won't last long, but lets see just how long. Just doing the robbers a favour I guess (also because I don't know eso golf langs ;_;)

umm, I accidentally bad code but someone cracked my lower score so...

computes A000217

Title: Can you outgolf me? (Cops section)

Body:
Cops section

The robbers section can be found here.

Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions.

Challenge

Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (e.g. Python 3.5 ≠ Python 3.4, so that is not allowed), and when given n (using STDIN/function arguments/etc.), compute a(n) where a is an OEIS sequence of your choice. One of those programs is shorter than the other. You only need to submit the longer program of the two. The other one needs to be saved in case of not being cracked after 7 days. Your submission is cracked when your program has been outgolfed (whether it is by 1 byte or more).

For example, if the task you chose was to perform 2 × n, this could be a valid submission (in Python 2):

Python 2, 16 bytes, score = 15 / 16 = 0.9375

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

If your submission has been cracked, then you need to state that in your header like so:

Python 2, 16 bytes, score = 15 / 16 = 0.9375, [cracked] + link

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

Offset

This can be found on every OEIS page. For example, for A005843, the offset is 0,2. We only need to use the first one, which is 0. This means that the function is defined for all numbers ≥ 0.

In other words, the function OEIS(n) starts with n = 0. Your program needs to work for all cases given by OEIS.

More information can be found here.

Scoring

The score you get for your submission is equal to the following formula:

Score = Length (in bytes) of secret code ÷ Length (in bytes) of public code

The example above has the score 15 ÷ 16 = 0.9375.

The submission with the lowest score wins. Only submissions that have posted their solution will be eligible for winning.

Rules

The task you need to do is an OEIS sequence of your choice.

Given n, output OEIS(n). Deviation is not allowed, so you need to produce the exact same sequence (when given n, you need to output OEIS(n)).

Submissions that are not cracked within a period of 7 days are considered safe after the solution has been posted (submissions older than 7 days that do not have their solution posted are still vulnerable in being cracked).

In your submission, you need to post the following things: language name, byte count, full code, so no pastebin links etc. (to prevent answers like Unary), OEIS sequence, score with lengths of both programs and additionally, the encoding that is used.

Note: the same sequence cannot be posted twice in the same language. (For example, if the sequence A005843 has been done in Pyth, you cannot use Pyth again for that same sequence.)

Input and output are both in decimal (base 10)

Leaderboard

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

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Note

This challenge is finished. The final winner is feersum with his Seed answer. Congratulations! :).

You can still submit new cops, but be aware that they are no longer competing.

Body:
Python, 39 bytes, 26/39=2/3=0.666 cont. points, cracked

s=lambda x:x+s(x-1)if x==1else x+s(x-1)

won't last long, but lets see just how long. Just doing the robbers a favour I guess (also because I don't know eso golf langs ;_;)

umm, I accidentally bad code but someone cracked my lower score so...

computes A000217


Title: A Formula for Congruences

Body:
Batch, 148 bytes

@set p=%*
@set/ap=%p: =*%
@for %%e in (%*)do @for /l %%i in (1,1,%%e)do @call:l %%e %%i
@exit/b
:l
@set/an=p/%1*%2,r=n%%%1
@if %r%==1 echo %n%


答:
Python, <s>39</s> 17 bytes, Destructible Watermelon

lambda n:n*-~n>>1
```

Title: Can you outgolf me? (Robbers section)


答:
Mathematica, 27 bytes

```<code>PowerMod[a=LCM@@#/#,-1,#]a&
</code>```

Title: A Formula for Congruences

Body:
Mathematica, 27 bytes

PowerMod[a=LCM@@#/#,-1,#]a&


答:
J, 17 bytes, score = 0.8235 (14/17) (cracked)

```<code>(+/@(!+:)&i.-)@>:
</code>```

Computes A002478.

The funny thing is that this version was originally the short one to be kept secret.

Title: Can you outgolf me? (Cops section)

Body:
J, 17 bytes, score = 0.8235 (14/17) (cracked)

(+/@(!+:)&i.-)@>:

Computes A002478.

The funny thing is that this version was originally the short one to be kept secret.


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

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

Write the shortest code that either:

Generates the Fibonacci sequence without end.

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

You may use standard forms of input and output.

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

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

Leaderboard

/* Configuration */

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

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery(''+lang+'').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

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

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

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

table thead {
  font-weight: bold;
}

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
Haskell, <s>17</s> <s>15</s> 14 bytes

```<code>f=1:scanl(+)1f
</code>```

Try it online!

ContentLicense: CC BY-SA 4.0

Title: Fibonacci function or sequence

Body:
Haskell, <s>17</s> <s>15</s> 14 bytes

f=1:scanl(+)1f

Try it online!


问:
Finding "sub-palindromes".
The shortest code that finds all unique "sub-palindromes" of a string, that is: any substring with length > 1 that is a palindrome.

eg.1

```<code>input: "12131331"
output: "33", "121", "131", "313", "1331"
</code>```

eg.2

```<code>input: "3333"
output: "33", "333", "3333"
</code>```

ContentLicense: CC BY-SA 2.5

Title: Finding "sub-palindromes".

Body:
Prolog, 92

f(S,P):-append([_,X,_],S),X=[_,_|_],reverse(X,X),atom_codes(P,X).
p(S,R):-setof(P,f(S,P),R).

Sample use:

?- p("12131331",R).
R = ['121', '131', '1331', '313', '33'].

?- p("3333",R).
R = ['33', '333', '3333'].


答:
05AB1E, 9 bytes, score = 0.6667 (6/9), Cracked

```<code>ÐnŠ·sÉO4/
</code>```

Computes: A087811

Try it online

Title: Can you outgolf me? (Cops section)

Body:
05AB1E, 9 bytes, score = 0.6667 (6/9), Cracked

ÐnŠ·sÉO4/

Computes: A087811

Try it online


答:
05AB1E, <s>9</s> 4 bytes, Emigna

```<code>>n4÷
</code>```

Try it online!

Computes this function instead:

Title: Can you outgolf me? (Robbers section)

Body:
05AB1E, <s>9</s> 4 bytes, Emigna

>n4÷

Try it online!

Computes this function instead:


问:
Medieval orthography

Task

Your task is to convert a text into medieval orthography.

Details

j is converted to i and J to I.

u and U at the beginning of words are converted to v and V respectively.

v and V at anywhere except the beginning of words are converted to u and U respectively.

s is converted to ſ (U+017F) unless at the end of the word or preceded by another s.

Specs

A word is defined as a sequence of letters in abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.

All words will have at least two letters.

The input will only consist of printable ASCII characters (U+0020 - U+007E).

There will be no occurrences of more than two consecutive s. That is, sss will not be a substring of the input.

Testcases

Individual words:

```<code>Input       Output
------------------------
Joy         Ioy
joy         ioy
Universe    Vniuerſe
universe    vniuerſe
Success     Succeſs
successfull ſucceſsfull
Supervise   Superuiſe
supervise   ſuperuiſe
Super-vise  Super-viſe
I've        I've
majors      maiors
UNIVERSE    VNIUERSE
0universe   0vniuerſe
0verify     0verify
I0ve        I0ve
_UU_          _VU_
_VV_          _VU_
ss_         ſs_
</code>```

Whole paragraph:

```<code>Input:  Christian Reader, I have for thy use collected this small Concordance, with no small labour. For being to comprise much in little roome, I was to make choyse of the most principall and usefull places, and to rank them under such words as I thought most essentiall and materiall in the sentence, because the scant roome allotted unto me, would not permit that I should expresse them under every word in the verse, as it is the manner in large Concordances.

Output: Chriſtian Reader, I haue for thy vſe collected this ſmall Concordance, with no ſmall labour. For being to compriſe much in little roome, I was to make choyſe of the moſt principall and vſefull places, and to rank them vnder ſuch words as I thought moſt eſsentiall and materiall in the ſentence, becauſe the ſcant roome allotted vnto me, would not permit that I ſhould expreſse them vnder euery word in the verſe, as it is the manner in large Concordances.
</code>```

The SHA-256 hash of the output of the last testcase is:

```<code>5641899e7d55e6d1fc6e9aa4804f2710e883146bac0e757308afc58521621644
</code>```

Disclaimer

Medievall orthographie is not that conſtante. Pleaſe do not complayne if you ſhall ſee olde bookes with a different orthographie.

答:
JavaScript (ES6), 154

Using parseInt to identify alphabetic characters. Note: casually but luckily parseInt('undefined',36)|0 is < 0

s=>[...s].map((c,i)=>((n=v(c))-19?n==31&p>9?'uU':n!=30|p>9?c=='s'&s[i-1]!=c&v(s[i+1])>9?'?':c+c:'vV':'iI')[p=n,c<'a'|0],p=0,v=c=>parseInt(c,36)|0).join``
```
<p><strong>Less golfed</strong></p>
<pre class="lang-js prettyprint-override"><code>s=>
  [...s].map(
  (c,i)=>
  ((n=v(c))-19
  ?n==31&p>9
    ?'uU'
    :n!=30|p>9
      ?c=='s'&s[i-1]!=c&v(s[i+1])>9
        ?'ſ'
        :c+c
      :'vV'
  :'iI')[p=n,c<'a'|0],
  p=0,
  v=c=>parseInt(c,36)|0
).join``
</code>```

Test

F=
s=>[...s].map((c,i)=>((n=v(c))-19?n==31&p>9?'uU':n!=30|p>9?c=='s'&s[i-1]!=c&v(s[i+1])>9?'ſ':c+c:'vV':'iI')[p=n,c<'a'|0],p=0,v=c=>parseInt(c,36)|0).join``

out=(a,b,c)=>O.textContent+=a+'\n'+b+'\n'+c+'\n\n'

ti='Christian Reader, I have for thy use collected this small Concordance, with no small labour. For being to comprise much in little roome, I was to make choyse of the most principall and usefull places, and to rank them under such words as I thought most essentiall and materiall in the sentence, because the scant roome allotted unto me, would not permit that I should expresse them under every word in the verse, as it is the manner in large Concordances.'
to='Chriſtian Reader, I haue for thy vſe collected this ſmall Concordance, with no ſmall labour. For being to compriſe much in little roome, I was to make choyſe of the moſt principall and vſefull places, and to rank them vnder ſuch words as I thought moſt eſsentiall and materiall in the ſentence, becauſe the ſcant roome allotted vnto me, would not permit that I ſhould expreſse them vnder euery word in the verſe, as it is the manner in large Concordances.'
r=F(ti)
out(to==r?'OK':'KO',ti,r)

test=`Joy         Ioy
joy         ioy
Universe    Vniuerſe
universe    vniuerſe
Success     Succeſs
successfull ſucceſsfull
Supervise   Superuiſe
supervise   ſuperuiſe
Super-vise  Super-viſe
I've        I've
majors      maiors
UNIVERSE    VNIUERSE
0universe   0vniuerſe
0verify     0verify
I0ve        I0ve
_UU_          _VU_
_VV_          _VU_
ss_         ſs_`
.split('\n').map(t=>{
  var [i,o]=t.split(/\s+/),r=F(i)
  out(o==r?'OK':'KO',i,r)
})```
<pre class="snippet-code-css lang-css prettyprint-override"><code>#O {width:90%; overflow:auto; white-space: pre-wrap}</code>```

```</code>```

Title: Medieval orthography

Body:
JavaScript (ES6), 154

Using parseInt to identify alphabetic characters. Note: casually but luckily parseInt('undefined',36)|0 is < 0

s=>[...s].map((c,i)=>((n=v(c))-19?n==31&p>9?'uU':n!=30|p>9?c=='s'&s[i-1]!=c&v(s[i+1])>9?'?':c+c:'vV':'iI')[p=n,c<'a'|0],p=0,v=c=>parseInt(c,36)|0).join``

Less golfed

s=>
  [...s].map(
  (c,i)=>
  ((n=v(c))-19
  ?n==31&p>9
    ?'uU'
    :n!=30|p>9
      ?c=='s'&s[i-1]!=c&v(s[i+1])>9
        ?'ſ'
        :c+c
      :'vV'
  :'iI')[p=n,c<'a'|0],
  p=0,
  v=c=>parseInt(c,36)|0
).join``

Test

F=
s=>[...s].map((c,i)=>((n=v(c))-19?n==31&p>9?'uU':n!=30|p>9?c=='s'&s[i-1]!=c&v(s[i+1])>9?'ſ':c+c:'vV':'iI')[p=n,c<'a'|0],p=0,v=c=>parseInt(c,36)|0).join``

out=(a,b,c)=>O.textContent+=a+'\n'+b+'\n'+c+'\n\n'

ti='Christian Reader, I have for thy use collected this small Concordance, with no small labour. For being to comprise much in little roome, I was to make choyse of the most principall and usefull places, and to rank them under such words as I thought most essentiall and materiall in the sentence, because the scant roome allotted unto me, would not permit that I should expresse them under every word in the verse, as it is the manner in large Concordances.'
to='Chriſtian Reader, I haue for thy vſe collected this ſmall Concordance, with no ſmall labour. For being to compriſe much in little roome, I was to make choyſe of the moſt principall and vſefull places, and to rank them vnder ſuch words as I thought moſt eſsentiall and materiall in the ſentence, becauſe the ſcant roome allotted vnto me, would not permit that I ſhould expreſse them vnder euery word in the verſe, as it is the manner in large Concordances.'
r=F(ti)
out(to==r?'OK':'KO',ti,r)

test=`Joy         Ioy
joy         ioy
Universe    Vniuerſe
universe    vniuerſe
Success     Succeſs
successfull ſucceſsfull
Supervise   Superuiſe
supervise   ſuperuiſe
Super-vise  Super-viſe
I've        I've
majors      maiors
UNIVERSE    VNIUERSE
0universe   0vniuerſe
0verify     0verify
I0ve        I0ve
_UU_          _VU_
_VV_          _VU_
ss_         ſs_`
.split('\n').map(t=>{
  var [i,o]=t.split(/\s+/),r=F(i)
  out(o==r?'OK':'KO',i,r)
})

#O {width:90%; overflow:auto; white-space: pre-wrap}

<pre id=O></pre>


答:
Pyke, 11 bytes, score = 0.45 (5/11) [cracked]

```<code>hZRVoeX*oe+
</code>```

Calculates OEIS A180255

Try it here!

Title: Can you outgolf me? (Cops section)

Body:
Pyke, 11 bytes, score = 0.45 (5/11) [cracked]

hZRVoeX*oe+

Calculates OEIS A180255

Try it here!


答:
Retina, 28 bytes, score = 0.9286... (26/28), cracked by feersum

```<code>.+
$*
^$|^((^|\3)(^.|\1))*.$
</code>```

Computes A192687, (offset = 0).

Try it online! (The first line enables a linefeed-separated test suite.)

This is the difference between Hofstadter's male and female sequences. (Relevant PPCG challenge.)

This was my original code:

```<code>.+
$*
^((^.|\3)(\1)|){2,}$
</code>```

This answer was a bit of a gamble anyway, because the actual solution is based on a regex I announced to be the shortest known Fibonacci-testing regex in chat a few months ago. Luckily, no one seemed to remember that. :)

Title: Can you outgolf me? (Cops section)

Body:
Retina, 28 bytes, score = 0.9286... (26/28), cracked by feersum

.+
$*
^$|^((^|\3)(^.|\1))*.$

Computes A192687, (offset = 0).

Try it online! (The first line enables a linefeed-separated test suite.)

This is the difference between Hofstadter's male and female sequences. (Relevant PPCG challenge.)

This was my original code:

.+
$*
^((^.|\3)(\1)|){2,}$

This answer was a bit of a gamble anyway, because the actual solution is based on a regex I announced to be the shortest known Fibonacci-testing regex in chat a few months ago. Luckily, no one seemed to remember that. :)


问:
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.

答:
Dyalog APL, 10 bytes

```<code>⊢⍴⍨2⍴.5*⍨≢
</code>```

Explanation:

```<code>         ≢   length of the argument
     .5*⍨    square root
   2⍴        reshape that to a length-2 vector
⊢⍴⍨          reshape the input by that vector
</code>```

Tests:

```<code>      (⊢⍴⍨2⍴.5*⍨≢)'Hi, world'
Hi,
 wo
rld
      (⊢⍴⍨2⍴.5*⍨≢)'Hi, world! Hello'
Hi,
worl
d! H
ello
      (⊢⍴⍨2⍴.5*⍨≢)'Lorem ipsum dolor sit amt'
Lorem
 ipsu
m dol
or si
t amt
      (⊢⍴⍨2⍴.5*⍨≢) 'H'
H
</code>```

Title: A square of text

Body:
Dyalog APL, 10 bytes

⊢⍴⍨2⍴.5*⍨≢

Explanation:

         ≢   length of the argument
     .5*⍨    square root
   2⍴        reshape that to a length-2 vector
⊢⍴⍨          reshape the input by that vector

Tests:

      (⊢⍴⍨2⍴.5*⍨≢)'Hi, world'
Hi,
 wo
rld
      (⊢⍴⍨2⍴.5*⍨≢)'Hi, world! Hello'
Hi,
worl
d! H
ello
      (⊢⍴⍨2⍴.5*⍨≢)'Lorem ipsum dolor sit amt'
Lorem
 ipsu
m dol
or si
t amt
      (⊢⍴⍨2⍴.5*⍨≢) 'H'
H


答:
JavaScript (ES6), 111 bytes

```<code>s=>s.replace(/[a-z]+/gi,w=>w.replace(/j|J|^u|^U|\Bv|\BV|ss|s(?!$)/g,c=>"iIvVuUſ"["jJuUvVs".search(c)]||"ſs"))
</code>```

Explanation: Because JavaScript regexp has no lookbehind, I instead break up the string into words, which then allows me to use ^ and \B as negative and positive letter lookbehinds. ss is dealt with by matching separately, with the slightly awkward replacement expression which takes fewer bytes than either replacing only the first character of c or adding an extra s to both strings and using the matching substring.

Title: Medieval orthography

Body:
Task

Your task is to convert a text into medieval orthography.

Details

j is converted to i and J to I.

u and U at the beginning of words are converted to v and V respectively.

v and V at anywhere except the beginning of words are converted to u and U respectively.

s is converted to ſ (U+017F) unless at the end of the word or preceded by another s.

Specs

A word is defined as a sequence of letters in abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.

All words will have at least two letters.

The input will only consist of printable ASCII characters (U+0020 - U+007E).

There will be no occurrences of more than two consecutive s. That is, sss will not be a substring of the input.

Testcases

Individual words:

```<code>Input       Output
------------------------
Joy         Ioy
joy         ioy
Universe    Vniuerſe
universe    vniuerſe
Success     Succeſs
successfull ſucceſsfull
Supervise   Superuiſe
supervise   ſuperuiſe
Super-vise  Super-viſe
I've        I've
majors      maiors
UNIVERSE    VNIUERSE
0universe   0vniuerſe
0verify     0verify
I0ve        I0ve
_UU_          _VU_
_VV_          _VU_
ss_         ſs_
</code>```

Whole paragraph:

```<code>Input:  Christian Reader, I have for thy use collected this small Concordance, with no small labour. For being to comprise much in little roome, I was to make choyse of the most principall and usefull places, and to rank them under such words as I thought most essentiall and materiall in the sentence, because the scant roome allotted unto me, would not permit that I should expresse them under every word in the verse, as it is the manner in large Concordances.

Output: Chriſtian Reader, I haue for thy vſe collected this ſmall Concordance, with no ſmall labour. For being to compriſe much in little roome, I was to make choyſe of the moſt principall and vſefull places, and to rank them vnder ſuch words as I thought moſt eſsentiall and materiall in the ſentence, becauſe the ſcant roome allotted vnto me, would not permit that I ſhould expreſse them vnder euery word in the verſe, as it is the manner in large Concordances.
</code>```

The SHA-256 hash of the output of the last testcase is:

```<code>5641899e7d55e6d1fc6e9aa4804f2710e883146bac0e757308afc58521621644
</code>```

Disclaimer

Medievall orthographie is not that conſtante. Pleaſe do not complayne if you ſhall ſee olde bookes with a different orthographie.

Body:
JavaScript (ES6), 111 bytes

s=>s.replace(/[a-z]+/gi,w=>w.replace(/j|J|^u|^U|\Bv|\BV|ss|s(?!$)/g,c=>"iIvVuUſ"["jJuUvVs".search(c)]||"ſs"))

Explanation: Because JavaScript regexp has no lookbehind, I instead break up the string into words, which then allows me to use ^ and \B as negative and positive letter lookbehinds. ss is dealt with by matching separately, with the slightly awkward replacement expression which takes fewer bytes than either replacing only the first character of c or adding an extra s to both strings and using the matching substring.


答:
Snowman, 50 bytes, score = 0.9 (45 / 50) [cracked by Lynn]

```<code>((}#NDe`nOnO|`2nMNdE0nR2aGaZ::nM;aF;aM:nS;aF,nM*))
</code>```

This is a subroutine that takes a number as its argument and returns another number.

Computes A122649 (offset = 1).

Try it online!

Title: Can you outgolf me? (Cops section)

Body:
Snowman, 50 bytes, score = 0.9 (45 / 50) [cracked by Lynn]

((}#NDe`nOnO|`2nMNdE0nR2aGaZ::nM;aF;aM:nS;aF,nM*))

This is a subroutine that takes a number as its argument and returns another number.

Computes A122649 (offset = 1).

Try it online!


答:
Hexagony, 7 bytes, score = 0.857 (6/7), cracked

Not designed to be the winning submission, but definitely a brain cracker. It actually isn't that hard if you think about it :p. Code:

```<code>\!?__@(
</code>```

Or a more readable version:

```<code> \ !
? _ _
 @ (
</code>```

Computes A052246.

Try it online!.

Title: Can you outgolf me? (Cops section)

Body:
Hexagony, 7 bytes, score = 0.857 (6/7), cracked

Not designed to be the winning submission, but definitely a brain cracker. It actually isn't that hard if you think about it :p. Code:

\!?__@(

Or a more readable version:

 \ !
? _ _
 @ (

Computes A052246.

Try it online!.


答:
Java 1.7, 110 bytes

```<code>void f(String s){for(int i=-1,k=(int)Math.sqrt(s.length());++i<k;)System.out.println(s.substring(i*k,i*k+k));}
</code>```

Try it! (Ideone)

I tried another approach with a function returning the result as a string, but just having to declare the string and the return statement is already more expensive (byte-count-wise) than the print statement.

Gotta love Java's verbosity... :)

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:
Java 1.7, 110 bytes

void f(String s){for(int i=-1,k=(int)Math.sqrt(s.length());++i<k;)System.out.println(s.substring(i*k,i*k+k));}

Try it! (Ideone)

I tried another approach with a function returning the result as a string, but just having to declare the string and the return statement is already more expensive (byte-count-wise) than the print statement.

Gotta love Java's verbosity... :)


答:
Python 2, 43 bytes, score = 0.9302 (40/43), cracked

f=lambda n:n==1or-(-sum(map(f,range(n)))/3)

Computes A072493

Let's see if anybody can golf off all 3 bytes.

Title: Can you outgolf me? (Cops section)

Body:
Cops section

The robbers section can be found here.

Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions.

Challenge

Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (e.g. Python 3.5 ≠ Python 3.4, so that is not allowed), and when given n (using STDIN/function arguments/etc.), compute a(n) where a is an OEIS sequence of your choice. One of those programs is shorter than the other. You only need to submit the longer program of the two. The other one needs to be saved in case of not being cracked after 7 days. Your submission is cracked when your program has been outgolfed (whether it is by 1 byte or more).

For example, if the task you chose was to perform 2 × n, this could be a valid submission (in Python 2):

Python 2, 16 bytes, score = 15 / 16 = 0.9375

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

If your submission has been cracked, then you need to state that in your header like so:

Python 2, 16 bytes, score = 15 / 16 = 0.9375, [cracked] + link

```<code>print(2*input())
</code>```

Computes A005843, (offset = 0).

Offset

This can be found on every OEIS page. For example, for A005843, the offset is 0,2. We only need to use the first one, which is 0. This means that the function is defined for all numbers ≥ 0.

In other words, the function OEIS(n) starts with n = 0. Your program needs to work for all cases given by OEIS.

More information can be found here.

Scoring

The score you get for your submission is equal to the following formula:

Score = Length (in bytes) of secret code ÷ Length (in bytes) of public code

The example above has the score 15 ÷ 16 = 0.9375.

The submission with the lowest score wins. Only submissions that have posted their solution will be eligible for winning.

Rules

The task you need to do is an OEIS sequence of your choice.

Given n, output OEIS(n). Deviation is not allowed, so you need to produce the exact same sequence (when given n, you need to output OEIS(n)).

Submissions that are not cracked within a period of 7 days are considered safe after the solution has been posted (submissions older than 7 days that do not have their solution posted are still vulnerable in being cracked).

In your submission, you need to post the following things: language name, byte count, full code, so no pastebin links etc. (to prevent answers like Unary), OEIS sequence, score with lengths of both programs and additionally, the encoding that is used.

Note: the same sequence cannot be posted twice in the same language. (For example, if the sequence A005843 has been done in Pyth, you cannot use Pyth again for that same sequence.)

Input and output are both in decimal (base 10)

Leaderboard

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

Uncracked submissions

 Language	 Score	 User

Sort by: score creation

Safe submissions

 Language	 Score	 User

```

Note

This challenge is finished. The final winner is feersum with his Seed answer. Congratulations! :).

You can still submit new cops, but be aware that they are no longer competing.


问:
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

答:
Julia, 53 bytes

```<code>!x=[([1 1;1 0]^n)[2]for n=1:x]|>prod;n\k=!n/!(n-k)/!k
</code>```

Credits to @Lynn for his Fibonorial answer.

Title: Compute the Fibonomial Coefficient

Body:
Julia, 53 bytes

!x=[([1 1;1 0]^n)[2]for n=1:x]|>prod;n\k=!n/!(n-k)/!k

Credits to @Lynn for his Fibonorial answer.


答:
Hexagony, <s>7</s> 6 bytes, Adnan

```<code>?!/$(@
</code>```

Unfolded:

```<code> ? !
/ $ (
 @ .
</code>```

Try it online!

Same idea, slightly different layout.

Title: Can you outgolf me? (Robbers section)

Body:
Robbers section

The cops section can be found here.

Challenge

Your task is to outgolf the submissions of the cops in the same language and the same version (for example, Python 3.5 ≠ Python 3.4, so that is not allowed). A submission is outgolfed when the length in bytes is shorter than the original submission. You only need to golf off at least 1 byte in order to crack a submission. E.g. if the task was to perform 2 × n, and the submission was the following:

```<code>print(2*input())
</code>```

You could outgolf the cop by doing the following:

```<code>print 2*input()
</code>```

Or even this (since lambda's are allowed):

```<code>lambda x:2*x
</code>```

Post this with the following header:

```<code>##{language name}, <s>{prev byte count}</s> {byte count}, {cop's submission + link}
</code>```

For example:

Python 2, <s>16</s> 12 bytes, Adnan (+ link to submission)

```<code>lambda x:2*x
</code>```

Computes A005843, (offset = 0).

In that case, you have cracked the submission.

Scoring

The person with who cracked the most submissions is the winner.

Rules

The crack submission must be in the same language as the cop submission.

The same input should result into the same output (so a(2) = 4 should remain 4).

For languages such as Python, you can import libraries that are standard included within the language. (So, no numpy/sympy etc.)

Input and output are both in decimal (base 10).

Note

This challenge is finished. The winner of the Robbers section is feersum. The final scores for the CnR are shown below:

feersum: 16 cracks

Dennis: 12 cracks

Leaky Nun: 6 cracks

Lynn: 4 cracks

miles: 3 cracks

Martin Ender: 2 cracks

Emigna: 2 cracks

jimmy23013: 1 crack

Sp3000: 1 crack

randomra: 1 crack

alephalpha: 1 crack

nimi: 1 crack

Destructible Watermelon: 1 crack

Dom Hastings: 1 crack

Body:
Hexagony, <s>7</s> 6 bytes, Adnan

?!/$(@

Unfolded:

 ? !
/ $ (
 @ .

Try it online!

Same idea, slightly different layout.


问:
Determine if a number is divisible by 13 (without using 13 itself)
Your challenge, should you choose to accept it, is to create a function or a program that outputs "yes" if a given number is divisible by 13 and outputs "no" if it isn't.

Rules:

 - You're not allowed to use the number 13 anywhere.

 - No cop-out synonyms for 13 either (like using 15 - 2).

 - Bonus points will be awarded for not using modulus, additional bonus for not using division.

Scoring:

 - Your score will be the number of bytes in your code (whitespace not included) multiplied by your bonus.

 - If you didn't use modulus, that bonus is 0.90; if you didn't use division, that bonus is 0.90.

 - If you didn't use either, that bonus is 0.80.

 - The lower your score, the better.

The input will always be an integer greater than 0 and less than 2^32.

Your output should be a simple "yes" or "no".

Clarifications:

 - Using some roundabout method of generating the number 13 for use is acceptable.  Simple arithmetic synonyms like (10 + 3) are not allowed.

 - The function or program must literally output "yes" or "no" for if the given number is divisible by 13.

 - As always, clever solutions are recommended, but not required.

答:
GAP, 45 bytes * 0.8 = 36

Instead of giving one more solution that computes Gcd(26,n), I multiply with the one of the field with 169 elements (which has characteristic 13) and get zero iff n is divisible by 13. If I wanted a truthy result, I could just use IsZero, but to get a yes/no-String I turn that result into an ordinary integer, compute 0 to that power, add one and use that as index to a string list. Normally I could say list[index], but that doesn't work with list literals. However there is another short way:

```<code>n->\[\](["no","yes"],1+0^Int(n*One(GF(169))))
</code>```

Body:
GAP, 45 bytes * 0.8 = 36

Instead of giving one more solution that computes Gcd(26,n), I multiply with the one of the field with 169 elements (which has characteristic 13) and get zero iff n is divisible by 13. If I wanted a truthy result, I could just use IsZero, but to get a yes/no-String I turn that result into an ordinary integer, compute 0 to that power, add one and use that as index to a string list. Normally I could say list[index], but that doesn't work with list literals. However there is another short way:

n->\[\](["no","yes"],1+0^Int(n*One(GF(169))))


问:
A Fractional Year
My PPCG holiday is over :D

Intro

Fractional time is the year + (the value (minute of year) / number of minutes in the year).

Example calculation

You should assume that February always has 28 days and the year is always 365 days long.

Let's say we want to convert the time: 17:34 3rd March 2013 to fractional time. Firstly, you find how many minutes were in 2013: 525600 minutes. Let's call this x.

Next, you want to find out how many minutes there have been since the start of 2013. A few quick calculations will tell you that the answer is 88894 minutes:

There have been 61 days since the start of the year, which times 1440 (number of minutes in a day) equals 87840 minutes. In 17 hours are 1020 minutes (17*60). Now, we can add 87840, 1020 and 34 minutes to equal 88894 minutes.

Let's call this y.

Finally, you divide y by x and add the year, resulting in 2013.16912 (to 5 decimal places).

Input

The date and time will be given as a single string. The string will be in the following format:

```<code>YYYY-MM-DD hh:mm
</code>```

The time will always be in 24 hour format and the year will always be in the range 1900-2050 inclusive.

Examples

```<code>Input:  2016-08-06 23:48
Output: 2016.59723

Input:  2013-03-03 17:34
Output: 2013.16912

Input:  1914-11-11 11:11
Output: 1914.86155
</code>```

If you are going for the bounty, either ping me in the comments or in The Nineteenth Byte.

Challenge

Calculate the given date and time as a fractional year.

Give all output to five decimal places (you may round in anyway you wish: flooring, ceiling, or true rounding). Shortest code wins.

Bounty

I am offering a 100 rep bounty for the shortest program which also accepts the date in fractional year format and returns the time in YYYY-MM-DD hh:mm format. In essence, your program (or function) has to act in the following way:

```<code>f('1914-11-11 11:11') => 1914.86155
f('1914.86155')       => 1914-11-11 11:11
</code>```

t-clausen.dk - 154 bytes

Neil - 183 bytes

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Title: A Fractional Year

Body:
Perl 6, <s> 107 105 </s> 102 bytes

<s>{$/=.comb(/\d+/);($0+(sum(|flat(-1,31,28,(31,30,31,30,31)xx 2)[^$1],$2)*1440+$3*60+$4)/525600).fmt: '%.5f'}
{$/=.comb(/\d+/);fmt $0+(sum(|flat(-1,31,28,(31,30,31,30,31)xx 2)[^$1],$2)*1440+$3*60+$4)/525600: '%.5f'}</s>

{$/=.comb(/\d+/);fmt $0+(flat($2-1,31,28,(31,30,31,30,31)xx 2)[^$1].sum*1440+$3*60+$4)/525600: '%.5f'}
{$/=.comb(/\d+/);round $0+(flat($2-1,31,28,(31,30,31,30,31)xx 2)[^$1].sum*1440+$3*60+$4)/525600,.1⁵}

Explanation:

{
  $/ = .comb(/\d+/); # grab a list of only the digits
  # ｢$0｣ is short for ｢$/[0]｣

  fmt

    $0 # year
    +
    (
      flat(
        $2 -1,                     #    days
        31,28,(31,30,31,30,31)xx 2 # -+ months
      )[^$1].sum * 1440            # /
      + $3 * 60                    #    hours
      + $4                         #    minutes
    )
    /
    525600

  : '%.5f' # the ｢:｣ is used here as ｢fmt｣ is a method not a subroutine
}

Test:

#! /usr/bin/env perl6
use v6.c;
use Test;

# returns Str
my &fractional-year-a = {$/=.comb(/\d+/);fmt $0+(sum(flat($2-1,31,28,(31,30,31,30,31)xx 2)[^$1])*1440+$3*60+$4)/525600: '%.5f'}
# returns Rat
my &fractional-year-b = {$/=.comb(/\d+/);round $0+(sum(flat($2-1,31,28,(31,30,31,30,31)xx 2)[^$1])*1440+$3*60+$4)/525600,.1⁵}

my @tests = (
  '2016-08-06 23:48' => 2016.59723,
  '2013-03-03 17:34' => 2013.16912,
  '1914-11-11 11:11' => 1914.86155,
);

plan +@tests * 2;

for @tests -> $_ ( :key($input), :value($expected) ) {
  is-approx +fractional-year-a($input), +$expected, 1e-5, "a $input => $expected";
  is-approx +fractional-year-b($input), +$expected, 1e-5, "b $input => $expected";
}

1..6
ok 1 - a 2016-08-06 23:48 => 2016.59723
ok 2 - b 2016-08-06 23:48 => 2016.59723
ok 3 - a 2013-03-03 17:34 => 2013.16912
ok 4 - b 2013-03-03 17:34 => 2013.16912
ok 5 - a 1914-11-11 11:11 => 1914.86155
ok 6 - b 1914-11-11 11:11 => 1914.86155


答:
Brachylog, 27 bytes, score = 0.666... (18/27), Cracked!

```<code>+ybL:L:[1]co~c[A:B]hl-?,A*.
</code>```

Computes A010551 (offset = 0).

You can try it online here.

Explanation

Since the vast majority of people don't know this language, and since I'm posting this answer mostly to get people looking into it (See: Brachylog's Wiki), I'll provide a short explanation of the code above:

```<code>+           Add 1 to the input N
ybL         L = [1, 2, ..., N+1]
:L:[1]c     Construct a list [1, 2, ..., N+1, 1, 2, ..., N+1, 1]
o           Sort the list from smallest to biggest
~c[A:B]     A concatenated to B results in that sorted list
hl-?,       The length of A is N + 1
A*.         The output is the result of the product of all elements of A
</code>```

Title: Can you outgolf me? (Cops section)

Body:
Brachylog, 27 bytes, score = 0.666... (18/27), Cracked!

+ybL:L:[1]co~c[A:B]hl-?,A*.

Computes A010551 (offset = 0).

You can try it online here.

Explanation

Since the vast majority of people don't know this language, and since I'm posting this answer mostly to get people looking into it (See: Brachylog's Wiki), I'll provide a short explanation of the code above:

+           Add 1 to the input N
ybL         L = [1, 2, ..., N+1]
:L:[1]c     Construct a list [1, 2, ..., N+1, 1, 2, ..., N+1, 1]
o           Sort the list from smallest to biggest
~c[A:B]     A concatenated to B results in that sorted list
hl-?,       The length of A is N + 1
A*.         The output is the result of the product of all elements of A


问:
Showcase of Languages

Notes

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

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

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

How this works

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

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

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

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

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

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

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

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

Current answers, sorted alphabetically by language name

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

答:
Arithmescript

Making an entry for Arithmescript here.

Codes

Length 1 snippet

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

Prints the value of i in the console.

Factoids

I am the creator of Arithmescript.

Arithmescript extends JavaScript.

It is sort of discontinued.

Demos

You can try out code in the latest version of Arithmescript at the official site.

Title: Showcase of Languages

Body:
Arithmescript

Making an entry for Arithmescript here.

Codes

Length 1 snippet

i

Prints the value of i in the console.

Factoids

I am the creator of Arithmescript.

Arithmescript extends JavaScript.

It is sort of discontinued.

Demos

You can try out code in the latest version of Arithmescript at the official site.


答:
Ruby, 85 + 1 = 86 bytes

Run with ruby -p (+1 byte for p flag). Takes input on stdin.

gsub(/j|(?<=^|[^a-z])u|(?<=[a-z])v|(?<=^|[^s])s(?=[a-z])/i){$&.tr"jJsUuVv","iIfVvUu"}
```

Run the tests on ideone (wrapped in a lambda there because you can't give flags to ideone): http://ideone.com/AaZ8ya

Title: Medieval orthography

Body:
Ruby, 85 + 1 = 86 bytes

Run with ruby -p (+1 byte for p flag). Takes input on stdin.

gsub(/j|(?<=^|[^a-z])u|(?<=[a-z])v|(?<=^|[^s])s(?=[a-z])/i){$&.tr"jJsUuVv","iIfVvUu"}

Run the tests on ideone (wrapped in a lambda there because you can't give flags to ideone): http://ideone.com/AaZ8ya


答:
Python 3.5, 38 bytes, Score = 0.86842 (33/38) (Cracked):

```<code>G=lambda n:n<1and 1or(2*n-1)**2*G(n-1)
</code>```

Computes A001818.

Try It Online! (Ideone)

Title: Can you outgolf me? (Cops section)

Body:
Python 3.5, 38 bytes, Score = 0.86842 (33/38) (Cracked):

G=lambda n:n<1and 1or(2*n-1)**2*G(n-1)

Computes A001818.

Try It Online! (Ideone)


答:
Brachylog, <s>27</s> 21 bytes, Fatalize

```<code>yrb:1a:+a:[1]c*.
:2/.
</code>```

Try it online!

Title: Can you outgolf me? (Robbers section)

Body:
Brachylog, <s>27</s> 21 bytes, Fatalize

yrb:1a:+a:[1]c*.
:2/.

Try it online!


答:
Python 2, <s>43</s> 40, xsot

```<code>g=lambda n:n<2or-~sum(map(g,range(n)))/3
</code>```

Title: Can you outgolf me? (Robbers section)

Body:
Python 2, <s>43</s> 40, xsot

g=lambda n:n<2or-~sum(map(g,range(n)))/3


答:
Python + SymPy, 71 bytes

from sympy import*
lambda x:[(prod(x)/n)**totient(n)%prod(x)for n in x]
```

This uses the algorithm from my Jelly answer. I/O is in form of lists of SymPy numbers.

Title: A Formula for Congruences

Body:
The Chinese Remainder Theorem can be quite useful in modular arithmetic.

For example, consider the following set of congruence relations:

For sets of congruence relations like this, where all the bases (3, 5, 7 in this example) are co-prime with each other, there will be one and only one integer n between 1 and the product of the bases (3*5*7 = 105 in this example) inclusive that satisfies the relations.

In this example, the number would be 14, generated by this formula:

where 2, 4, and 0 are given from the above example.

70, 21, 15 are the coefficients of the formula and they are dependent on the bases, 3, 5, 7.

To calculate the coefficients of the formula (70, 21, 15 in our example) for a set of bases, we use the following procedure.

For each number a in a set of bases:

Find the product of all of the other bases, denoted as P.

Find the first multiple of P that leaves a remainder of 1 when divided by a. This is the coefficient of a.

For example, to calculate the coefficient that corresponds to the base 3, we find the product of all the other bases (i.e. 5*7 = 35) and then find the first multiple of that product that leaves a remainder of 1 when divided by the base.

In this case, 35 leaves a remainder of 2 when divided by 3, but 35*2 = 70 leaves a remainder of 1 when divided by 3, so 70 is the corresponding coefficient for 3. Similarly, 3*7 = 21 leaves a remainder of 1 when divided by 5 and 3*5 = 15 leaves a remainder of 1 when divided by 7.

In a nutshell

For each number a in a set of numbers:

Find the product of all of the other numbers, denoted as P.

Find the first multiple of P that leaves a remainder of 1 when divided by a. This is the coefficient of a.

The challenge

The challenge is, for a set of two or more bases, to find the set of corresponding coefficients.

The set of bases are guaranteed to be pairwise co-prime and each base is guaranteed to be larger than 1.

Your input is a list of integers as input [3,4,5] or space-separated string "3 4 5" or however your inputs work.

Your output should either be a list of integers or space-separated string that denotes the set of coefficients.

Test cases

```<code>input             output
[3,5,7]           [70,21,15]
[2,3,5]           [15,10,6]
[3,4,5]           [40,45,36]
[3,4]             [4,9]
[2,3,5,7]         [105,70,126,120]
[40,27,11]        [9801,7480,6480]
[100,27,31]       [61101,49600,56700]
[16,27,25,49,11]  [363825,2371600,2794176,5583600,529200]
</code>```

Many thanks to Leaky Nun for his help in writing this challenge. As always, if the problem is unclear, please let me know. Good luck and good golfing!

Body:
Python + SymPy, 71 bytes

from sympy import*
lambda x:[(prod(x)/n)**totient(n)%prod(x)for n in x]

This uses the algorithm from my Jelly answer. I/O is in form of lists of SymPy numbers.


答:
MATL, 11 bytes, score = 0.8181 (9/11), cracked

```<code>YftdA-1bn^*
</code>```

Computes the Möbius function, or A087811 (offset 1).

Try it online!

Resources for robbers

I think this one should be easy, but anyway here is some help.

Code explanation:

```<code>Yf     % Implicit input. Push array of prime factors, with repetitions
t      % Duplicate
d      % Compute consecutive differences
A      % 1 if all those differences are nonzero, 0 otherwise
-1     % Push -1
b      % Bubble up array of prime factors to the top of the stack
n      % Number of elements
^      % -1 raised to that
*      % Multiply. Implicitly display
</code>```

Language documentation.

MATL chatroom.

Title: Can you outgolf me? (Cops section)

Body:
MATL, 11 bytes, score = 0.8181 (9/11), cracked

YftdA-1bn^*

Computes the Möbius function, or A087811 (offset 1).

Try it online!

Resources for robbers

I think this one should be easy, but anyway here is some help.

Code explanation:

Yf     % Implicit input. Push array of prime factors, with repetitions
t      % Duplicate
d      % Compute consecutive differences
A      % 1 if all those differences are nonzero, 0 otherwise
-1     % Push -1
b      % Bubble up array of prime factors to the top of the stack
n      % Number of elements
^      % -1 raised to that
*      % Multiply. Implicitly display

Language documentation.

MATL chatroom.


答:
Python 3.5, <s>38</s> 36 bytes, R. Kap

```<code>G=lambda n:+(n<1)or(2*n-1)**2*G(n-1)
</code>```

Even if you don't accept True as 1, this is good enough.

Title: Can you outgolf me? (Robbers section)

Body:
Python 3.5, <s>38</s> 36 bytes, R. Kap

G=lambda n:+(n<1)or(2*n-1)**2*G(n-1)

Even if you don't accept True as 1, this is good enough.


答:
Matlab, <s>132</s> 115 bytes

```<code> d=input('');m=cumsum([-1 '# #"#"##"#"'-4]);year(d)+fix((((m(month(d))+day(d))*24+hour(d))*60+minute(d))/5.256)/10^5
</code>```

Rounds towards 0.

Hmmm... That's quite long.

That's using some builtins, but not the really helpful ones - because of leap years.

Parsing the string directly gives 2 more byte solution:

```<code>d=sscanf(input(''),'%d%[- :]');m=cumsum([-1 '# #"#"##"#"'-4]);d(1)+fix((((m(d(3))+d(5))*24+d(7))*60+d(9))/5.256)/10^5
</code>```

Newer Matlab versions probably have some better split function, but I'm running on 2012a.

Some bytes saved thanks to @Luis Mendo

Title: A Fractional Year

Body:
My PPCG holiday is over :D

Intro

Fractional time is the year + (the value (minute of year) / number of minutes in the year).

Example calculation

You should assume that February always has 28 days and the year is always 365 days long.

Let's say we want to convert the time: 17:34 3rd March 2013 to fractional time. Firstly, you find how many minutes were in 2013: 525600 minutes. Let's call this x.

Next, you want to find out how many minutes there have been since the start of 2013. A few quick calculations will tell you that the answer is 88894 minutes:

There have been 61 days since the start of the year, which times 1440 (number of minutes in a day) equals 87840 minutes. In 17 hours are 1020 minutes (17*60). Now, we can add 87840, 1020 and 34 minutes to equal 88894 minutes.

Let's call this y.

Finally, you divide y by x and add the year, resulting in 2013.16912 (to 5 decimal places).

Input

The date and time will be given as a single string. The string will be in the following format:

```<code>YYYY-MM-DD hh:mm
</code>```

The time will always be in 24 hour format and the year will always be in the range 1900-2050 inclusive.

Examples

```<code>Input:  2016-08-06 23:48
Output: 2016.59723

Input:  2013-03-03 17:34
Output: 2013.16912

Input:  1914-11-11 11:11
Output: 1914.86155
</code>```

If you are going for the bounty, either ping me in the comments or in The Nineteenth Byte.

Challenge

Calculate the given date and time as a fractional year.

Give all output to five decimal places (you may round in anyway you wish: flooring, ceiling, or true rounding). Shortest code wins.

Bounty

I am offering a 100 rep bounty for the shortest program which also accepts the date in fractional year format and returns the time in YYYY-MM-DD hh:mm format. In essence, your program (or function) has to act in the following way:

```<code>f('1914-11-11 11:11') => 1914.86155
f('1914.86155')       => 1914-11-11 11:11
</code>```

t-clausen.dk - 154 bytes

Neil - 183 bytes

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Matlab, <s>132</s> 115 bytes

 d=input('');m=cumsum([-1 '# #"#"##"#"'-4]);year(d)+fix((((m(month(d))+day(d))*24+hour(d))*60+minute(d))/5.256)/10^5

Rounds towards 0.

Hmmm... That's quite long.

That's using some builtins, but not the really helpful ones - because of leap years.

Parsing the string directly gives 2 more byte solution:

d=sscanf(input(''),'%d%[- :]');m=cumsum([-1 '# #"#"##"#"'-4]);d(1)+fix((((m(d(3))+d(5))*24+d(7))*60+d(9))/5.256)/10^5

Newer Matlab versions probably have some better split function, but I'm running on 2012a.

Some bytes saved thanks to @Luis Mendo


答:
Befunge, 121 bytes * 0.8 = 96.8

```<code>&:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-       #
yes"<      >      >      >      >      >      >      >      >      >      >      >      >"on",,@,,,"
</code>```

Uses the wraparound nature of Befunge's code--the top row repeatedly decrements the input number until reaching 0. When it reaches 0, it takes the next v down to the bottom row, where it either hits the one < or one of the twelve >s. The bottom row outputs "yes" if executed from right to left, and "no" from left to right.

Title: Determine if a number is divisible by 13 (without using 13 itself)

Body:
Your challenge, should you choose to accept it, is to create a function or a program that outputs "yes" if a given number is divisible by 13 and outputs "no" if it isn't.

Rules:

 - You're not allowed to use the number 13 anywhere.

 - No cop-out synonyms for 13 either (like using 15 - 2).

 - Bonus points will be awarded for not using modulus, additional bonus for not using division.

Scoring:

 - Your score will be the number of bytes in your code (whitespace not included) multiplied by your bonus.

 - If you didn't use modulus, that bonus is 0.90; if you didn't use division, that bonus is 0.90.

 - If you didn't use either, that bonus is 0.80.

 - The lower your score, the better.

The input will always be an integer greater than 0 and less than 2^32.

Your output should be a simple "yes" or "no".

Clarifications:

 - Using some roundabout method of generating the number 13 for use is acceptable.  Simple arithmetic synonyms like (10 + 3) are not allowed.

 - The function or program must literally output "yes" or "no" for if the given number is divisible by 13.

 - As always, clever solutions are recommended, but not required.

Body:
Befunge, 121 bytes * 0.8 = 96.8

&:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-:!#v_1-       #
yes"<      >      >      >      >      >      >      >      >      >      >      >      >"on",,@,,,"

Uses the wraparound nature of Befunge's code--the top row repeatedly decrements the input number until reaching 0. When it reaches 0, it takes the next v down to the bottom row, where it either hits the one < or one of the twelve >s. The bottom row outputs "yes" if executed from right to left, and "no" from left to right.


答:
J, <s>17</s> 12 bytes, miles

```<code>+/@(]!2*-)i:
</code>```

Pretty much the same as the original just more golfed. :)

i: having +1 range compared to i. is useful (and weird). If you use i. here n=0 will be incorrect but luckily i: solves that.

Try it online here.

Title: Can you outgolf me? (Robbers section)

Body:
Robbers section

The cops section can be found here.

Challenge

Your task is to outgolf the submissions of the cops in the same language and the same version (for example, Python 3.5 ≠ Python 3.4, so that is not allowed). A submission is outgolfed when the length in bytes is shorter than the original submission. You only need to golf off at least 1 byte in order to crack a submission. E.g. if the task was to perform 2 × n, and the submission was the following:

```<code>print(2*input())
</code>```

You could outgolf the cop by doing the following:

```<code>print 2*input()
</code>```

Or even this (since lambda's are allowed):

```<code>lambda x:2*x
</code>```

Post this with the following header:

```<code>##{language name}, <s>{prev byte count}</s> {byte count}, {cop's submission + link}
</code>```

For example:

Python 2, <s>16</s> 12 bytes, Adnan (+ link to submission)

```<code>lambda x:2*x
</code>```

Computes A005843, (offset = 0).

In that case, you have cracked the submission.

Scoring

The person with who cracked the most submissions is the winner.

Rules

The crack submission must be in the same language as the cop submission.

The same input should result into the same output (so a(2) = 4 should remain 4).

For languages such as Python, you can import libraries that are standard included within the language. (So, no numpy/sympy etc.)

Input and output are both in decimal (base 10).

Note

This challenge is finished. The winner of the Robbers section is feersum. The final scores for the CnR are shown below:

feersum: 16 cracks

Dennis: 12 cracks

Leaky Nun: 6 cracks

Lynn: 4 cracks

miles: 3 cracks

Martin Ender: 2 cracks

Emigna: 2 cracks

jimmy23013: 1 crack

Sp3000: 1 crack

randomra: 1 crack

alephalpha: 1 crack

nimi: 1 crack

Destructible Watermelon: 1 crack

Dom Hastings: 1 crack

Body:
J, <s>17</s> 12 bytes, miles

+/@(]!2*-)i:

Pretty much the same as the original just more golfed. :)

i: having +1 range compared to i. is useful (and weird). If you use i. here n=0 will be incorrect but luckily i: solves that.

Try it online here.


问:
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.

答:
Python, 183

Bijection is cached on disk.

```<code>x=raw_input()
try:d=eval(open('d').read())
except:d={'':'','1 ':'1 '}
t='1 '*not' 'in x
if x not in d:
 while t in d:t+=`(id(t)/9)%2`
 d[t]=x;d[x]=t
 open(*'dw').write(`d`)
print d[x]
</code>```

edit: Oops, looks like this isn't the first smartassed answer.  Mine's consistent between runs!

Body:
Python, 183

Bijection is cached on disk.

x=raw_input()
try:d=eval(open('d').read())
except:d={'':'','1 ':'1 '}
t='1 '*not' 'in x
if x not in d:
 while t in d:t+=`(id(t)/9)%2`
 d[t]=x;d[x]=t
 open(*'dw').write(`d`)
print d[x]

edit: Oops, looks like this isn't the first smartassed answer.  Mine's consistent between runs!


答:
MATL, <s>11</s> 10 bytes, Luis Mendo

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

Instead of doing -1^length(array) it converts the elements to Boolean values (which are always 1), negates them, and takes the product of the elements.

Title: Can you outgolf me? (Robbers section)

Body:
MATL, <s>11</s> 10 bytes, Luis Mendo

YftdAwg_p*

Instead of doing -1^length(array) it converts the elements to Boolean values (which are always 1), negates them, and takes the product of the elements.


答:
JavaScript, 113 Bytes

```<code>var input = document.querySelector("input").value;if(input/parseInt(atob("MTM=")) != 0) {alert(0);}else{alert(1)}
</code>```

var input = document.querySelector("input").value;
if(input/parseInt(atob("MTM=")) != 0) {alert(0);}else{alert(1)}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><input></code>```

Body:
JavaScript, 113 Bytes

var input = document.querySelector("input").value;if(input/parseInt(atob("MTM=")) != 0) {alert(0);}else{alert(1)}

var input = document.querySelector("input").value;
if(input/parseInt(atob("MTM=")) != 0) {alert(0);}else{alert(1)}

<input>


答:
Java: 304 260 257

I saved some bytes by compacting the memoization function a bit and removing f(n) entirely, replacing it with direct array access.

BigInteger[]c;BigInteger a(int n,int k){m(n);return g(n).divide(g(n-k)).divide(g(k));}BigInteger g(int n){return n<3?BigInteger.ONE:g(n-1).multiply(c[n-1]);}void m(int n){c=new BigInteger[n];for(int i=0;i<n;++i)c[i]=(i<2)?BigInteger.ONE:c[i-2].add(c[i-1]);}
```
<p>Unfortunately, <code>BigInteger</code> is required due to overflows and I had to add memoization. Even on a generation 6 i7, it was taking <em>way</em> too long to run with large inputs.</p>
<p>Ungolfed, with boilerplate <code>class</code> and <code>main</code> code:</p>
<pre class="lang-java prettyprint-override"><code>import java.math.BigInteger;

public class ComputeTheFibonomialCoefficient {

  public static void main(final String[] args) {
    // @formatter:off
    String[][] testData = new String[][] {
      { "0", "0", "1" },
      { "1", "1", "1" },
      { "2", "0", "1" },
      { "3", "2", "2" },
      { "8", "3", "1092" },
      { "11", "5", "1514513" },
      { "22", "7", "7158243695757340957617" },
      { "25", "3", "49845401197200" },
      { "50", "2", "97905340104793732225" },
      { "100", "1", "354224848179261915075" }
    };
    // @formatter:on

    for (String[] data : testData) {
      System.out.println("a(" + data[0] + ", " + data[1] + ")");
      System.out.println("  Expected -> " + data[2]);
      System.out.print("    Actual -> ");
      System.out.println(new ComputeTheFibonomialCoefficient().a(
          Integer.parseInt(data[0]), Integer.parseInt(data[1])));
      System.out.println();
    }
  }

  // Begin golf

  BigInteger[] c;

  BigInteger a(int n, int k) {
    m(n);
    return g(n).divide(g(n - k)).divide(g(k));
  }

  BigInteger g(int n) {
    return n < 3 ? BigInteger.ONE : g(n - 1).multiply(c[n - 1]);
  }

  void m(int n) {
    c = new BigInteger[n];
    for (int i = 0; i < n; ++i)
      c[i] = (i < 2) ? BigInteger.ONE : c[i - 2].add(c[i - 1]);
  }
  // End golf
}
</code>```

Program output:

a(0, 0)
  Expected -> 1
    Actual -> 1

a(1, 1)
  Expected -> 1
    Actual -> 1

a(2, 0)
  Expected -> 1
    Actual -> 1

a(3, 2)
  Expected -> 2
    Actual -> 2

a(8, 3)
  Expected -> 1092
    Actual -> 1092

a(11, 5)
  Expected -> 1514513
    Actual -> 1514513

a(22, 7)
  Expected -> 7158243695757340957617
    Actual -> 7158243695757340957617

a(25, 3)
  Expected -> 49845401197200
    Actual -> 49845401197200

a(50, 2)
  Expected -> 97905340104793732225
    Actual -> 97905340104793732225

a(100, 1)
  Expected -> 354224848179261915075
    Actual -> 354224848179261915075
```

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:
Java: 304 260 257

I saved some bytes by compacting the memoization function a bit and removing f(n) entirely, replacing it with direct array access.

BigInteger[]c;BigInteger a(int n,int k){m(n);return g(n).divide(g(n-k)).divide(g(k));}BigInteger g(int n){return n<3?BigInteger.ONE:g(n-1).multiply(c[n-1]);}void m(int n){c=new BigInteger[n];for(int i=0;i<n;++i)c[i]=(i<2)?BigInteger.ONE:c[i-2].add(c[i-1]);}

Unfortunately, BigInteger is required due to overflows and I had to add memoization. Even on a generation 6 i7, it was taking way too long to run with large inputs.

Ungolfed, with boilerplate class and main code:

import java.math.BigInteger;

public class ComputeTheFibonomialCoefficient {

  public static void main(final String[] args) {
    // @formatter:off
    String[][] testData = new String[][] {
      { "0", "0", "1" },
      { "1", "1", "1" },
      { "2", "0", "1" },
      { "3", "2", "2" },
      { "8", "3", "1092" },
      { "11", "5", "1514513" },
      { "22", "7", "7158243695757340957617" },
      { "25", "3", "49845401197200" },
      { "50", "2", "97905340104793732225" },
      { "100", "1", "354224848179261915075" }
    };
    // @formatter:on

    for (String[] data : testData) {
      System.out.println("a(" + data[0] + ", " + data[1] + ")");
      System.out.println("  Expected -> " + data[2]);
      System.out.print("    Actual -> ");
      System.out.println(new ComputeTheFibonomialCoefficient().a(
          Integer.parseInt(data[0]), Integer.parseInt(data[1])));
      System.out.println();
    }
  }

  // Begin golf

  BigInteger[] c;

  BigInteger a(int n, int k) {
    m(n);
    return g(n).divide(g(n - k)).divide(g(k));
  }

  BigInteger g(int n) {
    return n < 3 ? BigInteger.ONE : g(n - 1).multiply(c[n - 1]);
  }

  void m(int n) {
    c = new BigInteger[n];
    for (int i = 0; i < n; ++i)
      c[i] = (i < 2) ? BigInteger.ONE : c[i - 2].add(c[i - 1]);
  }
  // End golf
}

Program output:

a(0, 0)
  Expected -> 1
    Actual -> 1

a(1, 1)
  Expected -> 1
    Actual -> 1

a(2, 0)
  Expected -> 1
    Actual -> 1

a(3, 2)
  Expected -> 2
    Actual -> 2

a(8, 3)
  Expected -> 1092
    Actual -> 1092

a(11, 5)
  Expected -> 1514513
    Actual -> 1514513

a(22, 7)
  Expected -> 7158243695757340957617
    Actual -> 7158243695757340957617

a(25, 3)
  Expected -> 49845401197200
    Actual -> 49845401197200

a(50, 2)
  Expected -> 97905340104793732225
    Actual -> 97905340104793732225

a(100, 1)
  Expected -> 354224848179261915075
    Actual -> 354224848179261915075


问:
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.

答:
Ruby, <s>26</s> 20 bytes

```<code>10.times{puts'*'*10}
</code>```

Try it online!

Explanation

Runs 10 times; each time, it prints * (10 times), with an automatic line break at the end.

Kudos to OrangeFlash81 for saving me 6 bytes.

Title: Print a 10 by 10 grid of asterisks

Body:
Ruby, <s>26</s> 20 bytes

10.times{puts'*'*10}

Try it online!

Explanation

Runs 10 times; each time, it prints * (10 times), with an automatic line break at the end.

Kudos to OrangeFlash81 for saving me 6 bytes.


答:
Bash + GNU utilities, 25

```<code>fold -`dc -e${#1}vp`<<<$1
</code>```

Not so different to @Doorknob's answer, but dc is a shorter way to get the square root.

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:
Bash + GNU utilities, 25

fold -`dc -e${#1}vp`<<<$1

Not so different to @Doorknob's answer, but dc is a shorter way to get the square root.


答:
Retina, <s>55</s> <s>54</s> 50 bytes

```<code>T`jJvV`iIuU
Ti01`uUp`vVp`[a-z]+
s(s*[a-zA-Z])
ſ$1
</code>```

Try it online! (The first line enables a linefeed-separate test suite.)

Title: Medieval orthography

Body:
Task

Your task is to convert a text into medieval orthography.

Details

j is converted to i and J to I.

u and U at the beginning of words are converted to v and V respectively.

v and V at anywhere except the beginning of words are converted to u and U respectively.

s is converted to ſ (U+017F) unless at the end of the word or preceded by another s.

Specs

A word is defined as a sequence of letters in abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.

All words will have at least two letters.

The input will only consist of printable ASCII characters (U+0020 - U+007E).

There will be no occurrences of more than two consecutive s. That is, sss will not be a substring of the input.

Testcases

Individual words:

```<code>Input       Output
------------------------
Joy         Ioy
joy         ioy
Universe    Vniuerſe
universe    vniuerſe
Success     Succeſs
successfull ſucceſsfull
Supervise   Superuiſe
supervise   ſuperuiſe
Super-vise  Super-viſe
I've        I've
majors      maiors
UNIVERSE    VNIUERSE
0universe   0vniuerſe
0verify     0verify
I0ve        I0ve
_UU_          _VU_
_VV_          _VU_
ss_         ſs_
</code>```

Whole paragraph:

```<code>Input:  Christian Reader, I have for thy use collected this small Concordance, with no small labour. For being to comprise much in little roome, I was to make choyse of the most principall and usefull places, and to rank them under such words as I thought most essentiall and materiall in the sentence, because the scant roome allotted unto me, would not permit that I should expresse them under every word in the verse, as it is the manner in large Concordances.

Output: Chriſtian Reader, I haue for thy vſe collected this ſmall Concordance, with no ſmall labour. For being to compriſe much in little roome, I was to make choyſe of the moſt principall and vſefull places, and to rank them vnder ſuch words as I thought moſt eſsentiall and materiall in the ſentence, becauſe the ſcant roome allotted vnto me, would not permit that I ſhould expreſse them vnder euery word in the verſe, as it is the manner in large Concordances.
</code>```

The SHA-256 hash of the output of the last testcase is:

```<code>5641899e7d55e6d1fc6e9aa4804f2710e883146bac0e757308afc58521621644
</code>```

Disclaimer

Medievall orthographie is not that conſtante. Pleaſe do not complayne if you ſhall ſee olde bookes with a different orthographie.

Body:
Retina, <s>55</s> <s>54</s> 50 bytes

T`jJvV`iIuU
Ti01`uUp`vVp`[a-z]+
s(s*[a-zA-Z])
ſ$1

<a href="http://retina.tryitonline.net/#code=JShHYApUYGpKdlZgaUl1VQpUaTAxYHVVcGB2VnBgW2Etel0rCnMocypbYS16QS1aXSkKxb8kMQ&input=Sm95CmpveQpVbml2ZXJzZQp1bml2ZXJzZQpTdWNjZXNzCnN1Y2Nlc3NmdWxsClN1cGVydmlzZQpzdXBlcnZpc2UKU3VwZXItdmlzZQpJJ3ZlCm1ham9ycwpVTklWRVJTRQowdW5pdmVyc2UKMHZlcmlmeQpJMHZlCl9VVV8KX1ZWXwpzc18KQ2hyaXN0aWFuIFJlYWRlciwgSSBoYXZlIGZvciB0aHkgdXNlIGNvbGxlY3RlZCB0aGlzIHNtYWxsIENvbmNvcmRhbmNlLCB3aXRoIG5vIHNtYWxsIGxhYm91ci4gRm9yIGJlaW5nIHRvIGNvbXByaXNlIG11Y2ggaW4gbGl0dGxlIHJvb21lLCBJIHdhcyB0byBtYWtlIGNob3lzZSBvZiB0aGUgbW9zdCBwcmluY2lwYWxsIGFuZCB1c2VmdWxsIHBsYWNlcywgYW5kIHRvIHJhbmsgdGhlbSB1bmRlciBzdWNoIHdvcmRzIGFzIEkgdGhvdWdodCBtb3N0IGVzc2VudGlhbGwgYW5kIG1hdGVyaWFsbCBpbiB0aGUgc2VudGVuY2UsIGJlY2F1c2UgdGhlIHNjYW50IHJvb21lIGFsbG90dGVkIHVudG8gbWUsIHdvdWxkIG5vdCBwZXJtaXQgdGhhdCBJIHNob3VsZCBleHByZXNzZSB0aGVtIHVuZGVyIGV2ZXJ5IHdvcmQgaW4gdGhlIHZlcnNlLCBhcyBpdCBpcyB0aGUgbWFubmVyIGluIGxhcmdlIENvbmNvcmRhbmNlcy4" rel="nofollow">Try it online! (The first line enables a linefeed-separate test suite.)