221 votes

Hyperprogramming: N+N, N×N, N^N all in one

Jelly, 12 bytes N+N “(ẹ+)‘FQṖṪỌv Try it online! N×N ““((ẹẹ++))‘‘FFQQṖṖṪṪỌỌvv Try it online! N^N ...
  • 208k
130 votes

Is this even or odd?

ArnoldC, 299 283 bytes ...
  • 102k
108 votes

1, 2, Fizz, 4, Buzz

Hexagony, 91 bytes Thanks for the bounty :) Wow, I would never have imagined I could beat Martin’s Hexagony solution. But—who would have thunk it—I got it done. After several days of failure because ...
  • 3,225
96 votes

1, 2, Fizz, 4, Buzz

Python 2, 56 bytes i=0;exec"print i%3/2*'Fizz'+i%5/4*'Buzz'or-~i;i+=1;"*100 Try it online!
  • 31.1k
91 votes

Hyperprogramming: N+N, N×N, N^N all in one

><>, 41 bytes \< 1:: : &&* + i*n n c& %: 4l 0( .i n} &? Try it online: N+N, N*N, N^N. Assumes that the STDIN input is exactly one char. >&...
  • 61.4k
78 votes

Add two numbers

Minecraft 1.10, 221 characters (non-competing) See, this is what we have to deal with when we make Minecraft maps. Aside: There's no way to take a string input in Minecraft, so I'm cheating a bit by ...
  • 1,439
77 votes

Shift right by half a bit

Regex (ECMAScript+(?*)), 1169 929 887 853 849 708 bytes -141 bytes by using the second form of shortened division, where \$A^2 > C\$ Regex was never designed to ...
  • 10.8k
75 votes

Inverse function

Haskell, 11 bytes f=log pxe=f and in reverse order: f=exp gol=f This works without the "comment" trick. Instead each ...
  • 35.7k
68 votes

What do you get when you multiply 6 by 9? (42)

Mathematica, 15 bytes Byte count assumes Windows ANSI encoding (CP-1252). 6±9=42 ±n__:=1n Defines a binary operator ± which ...
65 votes

Compute the Adler-32 checksum

Mathematica, 46 bytes {1,4^8}.Fold[##+{0,#&@@#}&,{1,0},#]~Mod~65521& An anonymous function that takes an integer array and returns the Adler-32, with ...
58 votes

Reciprocal of a number (1/x)

Brain-Flak, 772 536 530 482 480 + 1 = 481 bytes Since Brain-Flak does not support floating point numbers I had to use the -c flag in order input and output with ...
  • 94.1k
58 votes

What do you get when you multiply 6 by 9? (42)

Haskell, 14 bytes 6&9=42 a&b=a*b Try it online!
56 votes

Evaluate the aspect ratio of a triangle

Jelly, 7 bytes SH_÷@HP Try it online! Explanation Let’s read this chain: The implicit argument is a list [a, b, c]. First ...
  • 67k
53 votes
Accepted

Add two numbers

Jelly, 1 byte + Try it online! Also works in 05AB1E, Actually, APL, BQN, Brachylog, Braingolf, Chocolate, ,,, (Commata), dc, Deorst, Factor, Fig**, Forth, Halfwit*,...
  • 208k
52 votes

1, 2, Fizz, 4, Buzz

Labyrinth, 94 bytes "):_1 \ } 01/3%70.105 " : @ " . " =";_""..:221 + _ "! 5%66.117 _:= " . ="*{"..:221 Sub-100! This was a fun one. Explanation Let'...
  • 61.4k
52 votes

Is this even or odd?

brainfuck, 8 bytes +[,>,]<. Input is in unary. Output is the 1 (truthy) for odd numbers and NUL (falsy) for even numbers. Try it online! How it works We ...
  • 208k
51 votes

Difference of three input integers

Python 3, 21 bytes lambda*l:sum(l)/2in l If two numbers add to the other, the sum of all three will be double that other number, so half the sum will be an element ...
  • 141k
50 votes

Show me the nearest demon

Python 2, 28 bytes lambda n:'6'*len(`-~n*3/11`)
  • 38.9k
48 votes

Reciprocal of a number (1/x)

Python 2, 10 bytes 1..__div__ Try it online!
  • 208k
46 votes

Abandon all squares, ye who divide me

05AB1E, 2 bytes fP Try it online! How it works ...
  • 208k
45 votes

Add two numbers

Binary lambda calculus, 4.125 bytes Input and output as Church numerals. 00000000 01011111 01100101 11101101 0 In lambda calculus, it is λm. λn. λf. λx. m f (n ...
  • 49k
45 votes

If A-B be in A-B A else B eh?

Python, 27 bytes lambda a,b:[a,b][2*b*b>a*b] Try it online! An arithmetic formula. Why is the negation of 2*b*b>a*b ...
  • 141k
44 votes
Accepted

Well that's odd... no wait, that's even!

CJam, 18 17 13 bytes Thanks to aditsu for saving 4 bytes. qW:O%eu~"eo"= Try the test suite here. (The test suite is too long for the permalink. Just copy them ...
43 votes

Yes, of course I'm an adult!

Python 2.7, 34 bytes lambda x:max(x,[18,1.4]['.'in`x`])
  • 67k
43 votes

Random point on a sphere

Wolfram Language (Mathematica), 20 bytes RandomPoint@Sphere[] Try it online! Does exactly what it says on the tin.
  • 18.2k
42 votes

Inverse function

APL, 3 bytes *⊣⍟ This is a function train. Monadic * returns e^x, monadic ...
  • 31.1k
42 votes

Addition in base -1+i

Python 2, 98 97 91 84 bytes s=input();L=1 for _ in`s`*8:s+=1098*int(str(s).translate('0011'*64));L*=10 print s%L This does I/O in decimal. The integers have to ...
  • 208k
42 votes

Moving modest minimum

Python 2, 41 bytes lambda l:[sorted(l)[x==min(l)]for x in l] Try it online! For each element x we check whether ...
  • 141k
41 votes

Divisibility test

Jelly, 1 byte This took me hours to golf. Try it online!
  • 57.9k

Only top scored, non community-wiki answers of a minimum length are eligible