# Tag Info

210

Jelly, 12 bytes N+N “(ẹ+)‘FQṖṪỌv Try it online! N×N ““((ẹẹ++))‘‘FFQQṖṖṪṪỌỌvv Try it online! N^N “““(((ẹẹẹ+++)))‘‘‘FFFQQQṖṖṖṪṪṪỌỌỌvvv Try it online! How it works Jelly has several different types of string literals; all of them start with a “. If the literal contains more than one “, a string array is returned, and “ separates the strings from each ...

120

ArnoldC, 299 283 bytes IT'S SHOWTIME HEY CHRISTMAS TREE i YOU SET US UP 0 GET YOUR ASS TO MARS i DO IT NOW I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELY GET TO THE CHOPPER i HERE IS MY INVITATION i I LET HIM GO 2 ENOUGH TALK TALK TO THE HAND i YOU HAVE BEEN TERMINATED This outputs 1 (which is truthy) for odd input and ...

90

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 I neither had the Hexagony colorer nor the EsotericIDE to check my solution. I got several aspects of the specification wrong, so I produced a few wrong “...

88

><>, 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. ><> is a 2D language, so we can make use of the fact that code semantics are mostly unchanged if we execute instructions downwards — the extra empty lines that ensue are just no-ops. The ...

80

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

75

Haskell, 11 bytes f=log pxe=f and in reverse order: f=exp gol=f This works without the "comment" trick. Instead each version defines an additional, but unused function (pxe/ gol).

70

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 making you input the numbers into the program itself. (It's somewhat justifiable because quite a few maps, like Lorgon111's Minecraft Bingo, require you to copy ...

68

Mathematica, 15 bytes Byte count assumes Windows ANSI encoding (CP-1252). 6±9=42 ±n__:=1n Defines a binary operator ± which solves the problem. We simply define 6±9=42 as a special case which takes precedence and then add a fallback definition which makes ± equal to multiplication. The latter uses a fairly interesting golfing trick. The reason this works ...

64

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 some improvements from miles and Martin (see comments). miles' is also 46 bytes, but faster: {1,4^8}.{Tr@#+1,Tr[Accumulate@#+1]}~Mod~65521&

62

Mathematica, 10 bytes Fibonorial Another Mathematica built-in soundly beaten by a golfing language without the built-in.

58

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

57

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 strings, hence the +1. (({})[((((()()()()())){}{})){}{}]){((<{}>))}{}({}<{({}[((((()()()){}())()){}{}){}]<>)<>}<>{({}<>[()()])<>}{}([]<{({}<>[()()])&...

56

Jelly, 7 bytes SH_÷@HP Try it online! Explanation Let’s read this chain: The implicit argument is a list [a, b, c]. First we read S. This takes the sum: a + b + c. Then, we read H. This halves it: (a + b + c)/2. (This is s.) Then, we read a dyad _ (subtract), followed by another dyad. This is a hook: it lacks a right argument, so it receives the ...

55

Regex (ECMAScript+(?*)), 1169 929 887 853 849 bytes Regex was never designed to do mathematics. It has no concept of arithmetic. However, when input is taken in the form of bijective unary, as a sequence of identical characters in which the length represents a natural number, it is possible to do a wide range of operations, building up from the simple ...

52

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 of the list. Python 3 is needed to avoid floor-division, unless the numbers are given like 3.0 rather than 3.

50

Python 2, 28 bytes lambda n:'6'*len(-~n*3/11)

49

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 start by incrementing the current cell with + to be able to enter the while loop [,>,]. In each iteration, , reads a byte from STDIN, > advances to the cell to the right, then , reads ...

47

Python 2, 10 bytes 1..__div__ Try it online!

46

Labyrinth, 94 bytes "):_1 \ } 01/3%70.105 " : @ " . " =";_""..:221 + _ "! 5%66.117 _:= " . ="*{"..:221 Sub-100! This was a fun one. Explanation Let's start with a brief primer on Labyrinth – feel free to skip this if you're already familiar with the basics: Labyrinth has two stacks – a main stack and an auxiliary stack. Both stacks have an ...

45

05AB1E, 2 bytes fP Try it online! How it works f Implicitly take input and compute the integer's unique prime factors. P Take the product.

44

Python 2.7, 34 bytes lambda x:max(x,[18,1.4]['.'inx])

44

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 equivalent to the problem condition a-b in symrange(a,b)? Note that x in symrange(a,b) is equivalent to 0 in symrange(a-x,b-x). Applying this to x=a-b gives 0 in symrange(b,2*b-a). The value 0 is included in the interval unless it ...

43

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 from the challenge spec.) Explanation q e# Read the input. W:O e# Push a -1 and store it in variable O. % e# Use the -1 to reverse the string, because CJam's stack-based nature and the ...

43

APL, 3 bytes *⊣⍟ This is a function train. Monadic * returns e^x, monadic ⍟ returns ln(x). ⊣ is a dyadic function that returns its left argument. Thus, *⊣⍟ is equivalent to just *, and the reverse ⍟⊣* is equivalent to just ⍟.

42

CJam, puts on his glasses q~33c (*_*) (*_")>⌐■-■ (⌐■_■) "]sG>4%,) Input via STDIN Try the code here Note that * in the code is not used as multiplying, but as a join operator Also note that the cool part of the code is not just string, half of it is actually the code involved in finding the square. So.. DEAL WITH IT This will help you in ...

42

Python 2, 98 97 91 84 bytes s=input();L=1 for _ ins*8:s+=1098*int(str(s).translate('0011'*64));L*=10 print s%L This does I/O in decimal. The integers have to be separated by the non-alphanumeric character +. Thanks to @xnor for golfing off 2 bytes! Try it on Ideone. How it works In Arithmetic in Complex Bases, the author shows how to add and multiply ...

42

Jelly, 1 byte + Try it online! Also works in 05AB1E, Actually, APL, Braingolf, ,,, (Commata), Factor, Forth, Implicit, J, Julia, K, kdb+, Keg, Ly, MathGolf, MATL, Pyke, Deorst, and Q.

42

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 f x). De Bruijn index: λ λ λ λ 4 2 (3 2 1) Lambda calculus is a concise way of describing a mapping (function). For example, this task can be written as λx. λy. x + y The thing to note is, that ...

41

Jelly, 1 byte ḍ This took me hours to golf. Try it online!

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