[Question]
  [
# Robbers section
The cops section can be found [here](https://codegolf.stackexchange.com/q/88979/34388).
### 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:
```
print(2*input())
```
You could outgolf the cop by doing the following:
```
print 2*input()
```
Or even this (since lambda's are allowed):
```
lambda x:2*x
```
Post this with the following header:
```
##{language name}, <s>{prev byte count}</s> {byte count}, {cop's submission + link}
```
For example:
> 
> ## Python 2, ~~16~~ 12 bytes, Adnan (+ link to submission)
> 
> 
> 
> ```
> lambda x:2*x
> 
> ```
> 
> Computes [A005843](https://oeis.org/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
> 
> 
> 
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~5~~ 4 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page), [George V. Williams](https://codegolf.stackexchange.com/a/89087/25180)
```
RÆḊḞ
```
[Try it here.](http://jelly.tryitonline.net/#code=UsOG4biK4bie&input=&args=MTI)
A hidden feature!
If I remembered correctly, `ÆḊ`(A) = sqrt(det(AAT)) is n! times the n dimensional [Lebesgue measure](https://en.wikipedia.org/wiki/Lebesgue_measure) of a [simplex](https://en.wikipedia.org/wiki/Simplex) formed by n input point and the origin in m dimensional space. When n=1 it degenerate to the Euclidean distance. Not that weird after all...
[Answer]
## [Hexagony](https://github.com/m-ender/hexagony), ~~91~~ 33 bytes, [Blue](https://codegolf.stackexchange.com/a/89090/8478)
```
1""?{\>{+/</+'+./_'..@'~&/!}'+=($
```
Unfolded:
```
    1 " " ?
   { \ > { +
  / < / + ' +
 . / _ ' . . @
  ' ~ & / ! }
   ' + = ( $
    . . . .
```
[Try it online!](http://hexagony.tryitonline.net/#code=MSIiP3tcPnsrLzwvKycrLi9fJy4uQCd-Ji8hfScrPSgk&input=MTA)
Still looks somewhat golfable but I figured I'd post it before FryAmTheEggman beats me to it. ;)
### Explanation
Here are some colour-coded execution paths:
[![enter image description here](https://i.stack.imgur.com/bEm1o.png)](https://i.stack.imgur.com/bEm1o.png)
However, these are unnecessarily convoluted due to golfing. Here is the exact same code with a saner layout:
[![enter image description here](https://i.stack.imgur.com/WejUK.png)](https://i.stack.imgur.com/WejUK.png)
That's better. And finally, here is a memory diagram, where the red arrow indicates the initial position and orientation of the memory pointer (MP):
[![enter image description here](https://i.stack.imgur.com/IEckm.png)](https://i.stack.imgur.com/IEckm.png)
The gist is that I'm iteratively computing Fibonacci numbers on the three edges labelled **f(i)**, **f(i+1)** and **f(i+2)** while keeping track of the iterator on the edges **A**, **B** and **C**. While doing so the roles of these edges are swapped out cyclically after each iteration. Let's see how this happens...
The code starts on the grey path which does some initial setup. Note that **f(i)** already has its correct initial value of `0`.
```
1   Set edge f(i+1) to 1.
""  Move the MP to edge A.
?   Read input n into edge A.
)   Increment n.
```
Now the green path is the main loop. `_` and `>` are just mirrors.
```
(     Decrement n.
<     If the result is zero or less, continue on the red path, otherwise
      perform another iteration of the main loop.
{     Move the MP to edge f(i+2).
+     Add edges f(i) and f(i+1) into this edge, computing the next Fibonacci number.
'     Move the MP to the edge opposite A.
~     Multiply by -1 to ensure that it's non-positive (the edge may have a positive
      value after a few iterations).
&     Copy the current value of n from A.
'     Move back and to the right again.
+     Copy n by adding it to zero. Since we know that the other adjacent edge
      is always zero, we no longer need to use ~&.
'+'+  Repeat the process twice, moving n all the way from A to B.
=     Reverse the orientation of the MP so that it points at f(i) which now
      becomes f(i+2) for the next iteration.
```
This way, the MP moves around the inner triplet of edges, computing successive Fibonacci numbers until `n` reaches zero. Then finally the red path is executed:
```
{}    Move the MP to f(i).
!     Print it.
@     Terminate the program.
```
---
Diagrams generated with Timwi's [HexagonyColorer](https://github.com/Timwi/HexagonyColorer) and [EsotericIDE](https://github.com/Timwi/EsotericIDE).
[Answer]
## Cheddar, ~~7~~ 6 bytes, [Downgoat](https://codegolf.stackexchange.com/a/89051/30688)
```
(<<)&1
```
This seems to work, but it's always possible that I don't understand the language correctly.
[Answer]
# Haskell, ~~5~~ 4 bytes, [xnor](https://codegolf.stackexchange.com/a/89044/48934)
```
(^)1
```
Simple currying.
[Answer]
## Stack Cats, ~~14~~ 13 bytes, [feersum](https://codegolf.stackexchange.com/a/89484/21487)
```
^]T{_+:}_
```
with the `-nm` flags for +4 bytes. 
[Try it online!](http://stackcats.tryitonline.net/#code=Xl1Ue18rOn1f&input=MTAwMA&args=LW5t)
Okay, that loop was nuts. I tried several approaches, such as brute forcing over a reduced alphabet and brute forcing `3x+2` or `5x+4` and trying to extend it, but I never expected the solution to *actually* contain a loop.
The best way to see how this works is to add a `D` flag for debugging (so run with `-nmD`) and turn debug on for the above TIO link. A `{}` loop remembers the top of stack at the beginning of the loop, and exits when the top of stack is that value again. The interior of the loop does some fun subtracting and cycling of the top three elements of the stack, which is how the loop gets to run for so many iterations.
[Answer]
# [Sesos, ~~14~~ 11 bytes, Leaky Nun](https://codegolf.stackexchange.com/a/88985/3852)
Computes **n2**. [Try it here.](http://sesos.tryitonline.net/#code=c2V0IG51bWluCnNldCBudW1vdXQKZ2V0CmptcAogIGptcCwgc3ViIDEsIGZ3ZCAxLCBhZGQgMSwgZndkIDEsIGFkZCAyLCByd2QgMiwgam56CiAgZndkIDIsIHN1YiAxCiAgcndkIDEsIHN1YiAxCiAgam1wLCBzdWIgMSwgcndkIDEsIGFkZCAxLCBmd2QgMSwgam56CiAgcndkIDEKam56CmZ3ZCAyCnB1dA&input=MTM)
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
```
[Answer]
## Woefully, ~~776~~ 759 bytes, [Destructible Watermelon](https://codegolf.stackexchange.com/a/92485/30688)
```
| |||||||| | |
|| |||||| |
||| |||| |
|||| || |
||||| || |
|||| |||| |
||| |||||| |
|| |||||||| |
| |||||||||| |
|| |||||||| |
||| ||||||| |
||||||||||| |
||||||||||| |
||||||||||| |
||||||||||| |
|||||||||| |
||||||||| |
||||||||| |
||||||||| |
||||||||| |
|||||||||| |
||||||||||| |
|||||||||||| |
||||||||||| |
|||||||||| |
||||||||| |
|||||||| |
||||||| |
|||||| |
||||| |
|||| |
||| |
|| |
| |
| |
| |
|| |
|| |
|| |
|| |
|| |
| |
| |
| |
|| |
||| |
|||| |
||||| |
|||||| |
||||||| |
|||||| |
||||||| |
|||||||| |
||||||||| |
|||||||||| |
||||||||||| |
|||||||||||| |
||||||||||| |
|||||||||| |
||||||||| |
|||||||| |
||||||| |
|||||| |
||||| |
|||| |
||| |
|| |
| |
| |
| |
| |
|| |
| |
|| |
||| |
||| |
|||| |
||| |
|| |
| |
| |
| |
|| |
|| |
|| |
|| |
```
I tried to read the source code for this language but it was too confusing. For one thing, `ip[1]` is a line number while `ip[0]` is the column number, while the `cp` coordinates are used the other way around. Yet, sometimes the value of `cp` is assigned to `ip`. I gave up on trying to understand what the program is doing and found a way to encode the identical sequence of instructions using fewer bars.
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), ~~27~~ 21 bytes, [Fatalize](https://codegolf.stackexchange.com/a/89017/48934)
```
yrb:1a:+a:[1]c*.
:2/.
```
[Try it online!](http://brachylog.tryitonline.net/#code=eXJiOjFhOithOlsxXWMqLgo6Mi8u&input=MTA&args=Wg)
[Answer]
# J, ~~17~~ 12 bytes, [miles](https://codegolf.stackexchange.com/a/88999/7311)
```
+/@(]!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.](http://tryj.tk/)
[Answer]
# M, ~~10~~ 6 bytes, [Dennis](https://codegolf.stackexchange.com/a/89066/6710)
```
R×\³¡Ṫ
```
Given *n*, it computes the *nth*-level factorial of *n*. This was a fun exercise!
The code is capable of running as Jelly so you can [Try it online](http://jelly.tryitonline.net/#code=UsOXXMKzwqHhuao&input=&args=NA).
## Explanation
```
R×\³¡Ṫ  Input: n
R       Create the range [1, 2, ..., n]
   ³¡   Repeat n times starting with that range
 ×\       Find the cumulative products
     Ṫ  Get the last value in the list
        Return implicitly
```
[Answer]
# Snowman, ~~50~~ 44 bytes, [Doorknob](https://codegolf.stackexchange.com/a/89008/3852)
```
((}#2nMNdE0nR1`wRaC2aGaZ::nM;aF;aM:`nS;aF*))
```
[Try it online!](http://snowman.tryitonline.net/#code=fnZnMTBzQiogLy8gcmVhZCBpbnB1dCBmcm9tIFNURElOIGFuZCBwYXNzIGl0IHRvIHRoZSBzdWJyb3V0aW5lCgooKH0jMm5NTmRFMG5SMWB3UmFDMmFHYVo6Om5NO2FGO2FNOmBuUzthRiopKQoKI3RTc1AgICAgLy8gb3V0cHV0IHRoZSByZXR1cm4gdmFsdWUgdG8gU1RET1VU&input=MTA)
[Answer]
## Haskell, ~~15~~ 14 bytes, [xnor](https://codegolf.stackexchange.com/a/92488/30688)
```
until odd succ
```
I spent a fruitless couple of hours learning to decipher "pointless" syntax... `until` I found this instead.
Or for a less mellifluous 13 bytes, `until odd(+1)`.
[Answer]
## Python 2, ~~43~~ 40, [xsot](https://codegolf.stackexchange.com/a/89011/30688%5D)
```
g=lambda n:n<2or-~sum(map(g,range(n)))/3
```
[Answer]
# [Pyke, ~~11~~ 9 bytes, muddyfish](https://codegolf.stackexchange.com/a/89004/12012)
```
hVoeX*oe+
```
[Try it here!](http://pyke.catbus.co.uk/?code=hVoeX%2aoe%2B&input=4)
### How it works
```
          Implicit input: n (accumulator), n (iterations)
h         Increment the number of iterations.
 V        Do the following n + 1 times.
  o         Iterator. Pushes its value (initially 0) and increments it.
   e        Perform integer division by 2.
            This pushes 0 the first time, then 1, then 2, etc.
    X       Square the result.
     *      Multiply the accumulator and the result.
      oe    As before.
        +   Add the result to the accumulator.
            This sets the accumulator to a(0) = 0 in the first iteration and
            applies the recursive formula in all subsequent ones.
```
[Answer]
## [05AB1E](https://github.com/Adriandmen/05AB1E), ~~7~~ 4, [Emigna](https://codegolf.stackexchange.com/a/89134/9288)
```
LnOx
```
> 
> From the formula for the sum of squares of positive integers 1^2 + 2^2 + 3^2 + ... + n^2 = n(n+1)(2\*n+1)/6, if we multiply both sides by 2 we get Sum\_{k=0..n} 2\*k^2 = n(n+1)(2\*n+1)/3, which is an alternative formula for this sequence. - Mike Warburton (mikewarb(AT)gmail.com), Sep 08 2007
> 
> 
> 
[Answer]
## Jelly, ~~22~~ 21 bytes, [Dennis](https://codegolf.stackexchange.com/a/89836/30688)
```
_²×c×Ḥc¥@÷⁸÷’{S
‘µR+ç
```
I spent several hours reading Jelly source code for the last one, so I might as well put this "skill" to use. I hope @Dennis will share with us his mathematical discoveries allowing a shorter formula (assuming there is something and not only weird Jelly tricks!).
[Answer]
# J, ~~20~~ 19 bytes, [miles](https://codegolf.stackexchange.com/a/89886/12012)
```
[:+/2^~+/@(!|.)\@i.
```
This computes the product as a sum of squared Fibonacci numbers, which are calculated as a sum of binomial coefficients.
Thankfully, @miles himself posted the code to generate Fibonacci numbers [in this comment](https://codegolf.stackexchange.com/questions/86944/fibonacci-orial/86977#comment213743_86977).
[Answer]
# [*Acc!!*, ~~526~~ 525 bytes, DLosc](https://codegolf.stackexchange.com/a/90448/12012)
```
N
Count x while _%60-46 {
(_+_%60*5-288)*10+N
}
_/60
Count i while _/27^i {
_+27^i*(_/27^i*26-18)
}
_*3+93
Count i while _/27^i/27%3 {
_-i%2*2+1
Count j while _/3^(3*j+2-i%2)%3 {
_+3^(1+i%2)
Count k while _/3^(3*k+1+i%2)%3-1 {
_+3^(3*k+1+i%2)*26
}
}
}
Count i while _/27^i/3 {
_-_/27^i/3%27*27^i*3+_/3^(3*i+1+_%3)%3*3
}
_/3
Count i while _/100^i {
_*10-(_%100^i)*9
}
Count i while _/100^i/10 {
_+_/100^i/10%10
Count j while i+1-j {
_+(_%10-_/100^(j+1)%10)*(100^(j+1)-1)
}
}
_/100
Count j while _/100^j {
Write _/100^j%10+48
}
```
I have no idea how this works, but I was able to spot a tiny improvement.
```
24c24
< _+_/100^i*100^i*9
---
> _*10-(_%100^i)*9
```
[Answer]
## Haskell, 10 bytes, [xnor](https://codegolf.stackexchange.com/a/97130/34531)
```
gcd=<<(2^)
```
Usage example: `map ( gcd=<<(2^) ) [1..17]` -> `[1,2,1,4,1,2,1,8,1,2,1,4,1,2,1,16,1]`.
How it works: From the [oeis page](https://oeis.org/A006519) we see that `a(n) = gcd(2^n, n)` or written in Haskell syntax: `a n = gcd (2^n) n`. Functions with the pattern `f x = g (h x) x` can be turned to point-free via the function `=<<`: `f = g =<< h`, hence `gcd=<<(2^)` which translates back to `gcd (2^x) x`. 
[Answer]
# [Sesos, ~~14~~ 9 bytes, Leaky Nun](https://codegolf.stackexchange.com/a/88991/3852)
Computes **n mod 16**. [Try it here.](http://sesos.tryitonline.net/#code=c2V0IG51bWluCnNldCBudW1vdXQKc2V0IG1hc2sKZ2V0CmptcCwgc3ViIDEsIGZ3ZCAxLCBhZGQgMTYsIHJ3ZCAxLCBqbnoKZndkIDEKam1wLCBzdWIgMTYsIGZ3ZCAxLCBhZGQgMSwgcndkIDEsIGpuegpmd2QgMQpwdXQ&input=MzM)
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
```
[Answer]
# [Python, ~~39~~ 17 bytes, Destructible Watermelon](https://codegolf.stackexchange.com/a/88994/48934)
```
lambda n:n*-~n>>1
```
[Answer]
# [05AB1E, ~~9~~ 4 bytes, Emigna](https://codegolf.stackexchange.com/a/89000/48934)
```
>n4÷
```
[Try it online!](http://05ab1e.tryitonline.net/#code=Pm40w7c&input=MjU)
Computes this function instead:
[![formula](https://i.stack.imgur.com/lLu9J.gif)](https://i.stack.imgur.com/lLu9J.gif)
[Answer]
## [Hexagony](https://github.com/m-ender/hexagony), ~~7~~ 6 bytes, [Adnan](https://codegolf.stackexchange.com/a/89009/8478)
```
?!/$(@
```
Unfolded:
```
 ? ! 
/ $ (
 @ .
```
[Try it online!](http://hexagony.tryitonline.net/#code=ID8gISAKLyAkICgKIEAgLg&input=Nw&debug=on)
Same idea, slightly different layout.
[Answer]
## MATL, ~~11~~ 10 bytes, [Luis Mendo](https://codegolf.stackexchange.com/a/89024/30688)
```
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.
[Answer]
# Jelly, ~~11~~ 10, [Dennis](https://codegolf.stackexchange.com/a/89061/48934)
```
Ḥ’_Rc’*@RP
```
Vectorized version of same approach.
[Try it online!](http://jelly.tryitonline.net/#code=4bik4oCZX1Jj4oCZKkBSUArFvMOH4oKsRw&input=&args=MSwgMiwgMywgNCwgNQ)
[Answer]
# [05AB1E, ~~10~~ 8 bytes, Adnan](https://codegolf.stackexchange.com/a/89092/3852)
```
µNÂÂQ>i¼
```
[Try it online](http://05ab1e.tryitonline.net/#code=wrVOw4LDglE-acK8&input=NDU).
[Answer]
# [Brachylog, ~~11~~ 10 bytes, Fatalize](https://codegolf.stackexchange.com/a/89219/48934)
```
yb:AcLrLc.
```
[Try it online!](http://brachylog.tryitonline.net/#code=eWI6QWNMckxjLg&input=MTE&args=Wg)
## Explanation
Brachylog is a Prolog-derived languages, whose greatest ability is to prove things.
Here, we prove these statements:
```
yb:AcLrLc.
yb:AcL       Inclusive range from 1 to input, concatenated with A, gives L
     LrL     L reversed is still L
       Lc.   L concatenated is output
```
[Answer]
# Jelly, ~~9~~ 8 bytes, [Dennis](https://codegolf.stackexchange.com/a/89115/6710)
```
œċr0$L€Ḅ
```
Sorry! I wasn't able to find your intended solution.
This relies on the fact that `C(n+k-1, k)` is the number of ways to choose `k` values from `n` with replacement.
Note: This is inefficient since it generates the possible sets in order to count them, so try to avoid using large values of *n* online.
[Try it online](http://jelly.tryitonline.net/#code=xZPEi3IwJEzigqzhuIQ&input=&args=NA) or [Verify up to *n*](http://jelly.tryitonline.net/#code=xZPEi3IwJEzigqzhuIQKMHLFvMOH4oKsJEc&input=&args=MTA).
I later found another 8 byte version that is efficient enough to compute *n* = 1000. This computes the values using the binomial coefficient and avoids generating the lists.
```
Ḷ+c’Ṛ;1Ḅ
```
[Try it online](http://jelly.tryitonline.net/#code=4bi2K2PigJnhuZo7MeG4hA&input=&args=NA) or [Verify up to *n*](http://jelly.tryitonline.net/#code=4bi2K2PigJnhuZo7MeG4hAowcsW8w4figqwkRw&input=&args=MTA).
## Explanation
```
œċr0$L€Ḅ  Input: n
  r0$     Create a range [n, n-1, ..., 0]
œċ        Create all combinations with replacement for
          (n, n), (n, n-1), ..., (n, 0)
     L€   Find the length of each
       Ḅ  Convert it from binary to decimal and return
Ḷ+c’Ṛ;1Ḅ  Input: n
Ḷ         Creates the range [0, 1, ..., n-1]
 +        Add n to each in that range
   ’      Get n-1
  c       Compute the binomial coefficients between each
    Ṛ     Reverse the values
     ;1   Append 1 to it
       Ḅ  Convert it from binary to decimal and return
```
[Answer]
## M, ~~9~~ 8 bytes, [Dennis](https://codegolf.stackexchange.com/a/89247/30688)​
```
Ḥrc’ḊḄḤ‘
```
[Answer]
## QBasic, ~~30~~ 29 bytes, [DLosc](https://codegolf.stackexchange.com/a/89857/30688)
```
INPUT n:?(n MOD 2)*(n+.5)+n/2
```
]