262 votes

Is this number a prime?

hello, world!, 13 hello, world!
histocrat's user avatar
  • 22.1k
170 votes

Is this number a prime?

Hexagony, 29 bytes .?'.).@@/'/.!.>+=(<.!)}($>(<% The readable version of this code is: ...
Etoplay's user avatar
  • 3,381
165 votes

Count of "a"s and "b"s must be equal. Did you get it computer?

Python 3, 32 bytes eval(input().translate(")("*50)) Try it online! Outputs via exit code: Error for false, no error for True. The string is evaluated as ...
xnor's user avatar
  • 144k
131 votes

Is this even or odd?

ArnoldC, 299 283 bytes ...
Luis Mendo's user avatar
  • 104k
121 votes

Golf all the 16 logic gates with 2 inputs and 1 output!

Dominoes, 122,000 bytes or 72 tiles The byte count is the size of the saved file which is 0.122 MB. Domino computing was the inspiration. I have tested all of ...
NonlinearFruit's user avatar
113 votes

"KNOT" or "NOT"?

Python 3, 457 316 306 bytes ...
Anders Kaseorg's user avatar
108 votes

Detect MS Windows

MATLAB, 4 bytes ispc From the documentation: tf = ispc returns logical 1 (true) if the version of MATLAB® software is for ...
Stewie Griffin's user avatar
107 votes
Accepted

Java is to JavaScript as Car is to Carpet

Java/JavaScript Polyglot, 108 107 106 bytes //\u000As->s.matches("(?i)(?!.*javascript)java.*"/* a=>/(?!.*javascript)^java/i.test(a/**/)?"car":"carpet" Run ...
Olivier Grégoire's user avatar
83 votes
Accepted

Detect MS Windows

Vim, 2 bytes <C-a>1 On Windows, <C-a> (ctrl+a) is mapped by default to ...
nmjcman101's user avatar
  • 3,664
81 votes

Magic the Gathering: Friends or Foes?

JavaScript (ES6),  26 23 17 15  14 bytes Takes input as two ASCII codes in currying syntax (a)(b). Returns 4 for ...
Arnauld's user avatar
  • 186k
76 votes

Is this number a prime?

Hexagony, 218 92 58 55 bytes Notice: This answer has been solidly beaten with a side-length 4 solution by Etoplay. ...
Martin Ender's user avatar
73 votes

Am I being run backwards?

Python 3, no comments or string literals, 106 bytes x=quit y=x.__class__ y.__add__=print y.__pos__=x x+x++x+x x=__sop__.y tnirp=__dda__.y __ssalc__.x=y tixe=x I've ...
user2357112's user avatar
  • 1,660
72 votes

Is this number a prime?

Pyth, 4 bytes }QPQ Prints True or False.
orlp's user avatar
  • 39k
71 votes

Is My Swipe Pattern Legal?

JavaScript (ES6), 64 bytes Takes input as an array of numbers. Falsy values are 0 or NaN. Truthy values are strictly positive integers. ...
Arnauld's user avatar
  • 186k
65 votes

Is this number a prime?

Retina, 16 bytes ^(?!(..+)\1+$).. Try it online! Let's start with a classic: detecting primes with a regex. Input should be given in unary, using any repeated ...
Martin Ender's user avatar
62 votes

Is it double speak?

Python 3, 24 bytes lambda s:s[::2]==s[1::2] Try it online!
Jitse's user avatar
  • 6,846
58 votes

Will it halt? (Cops)

Malbolge, 128 bytes, cracked by KBRON111 ...
Doorknob's user avatar
  • 71.4k
57 votes

I'm a palindrome. Are you?

Pyth, 3 bytes _I_ Returns True or False. Try it online! How it works ...
Dennis's user avatar
  • 209k
55 votes
Accepted

Is my prison secure?

Snails, 13 bytes !(t\P(o\ ),o~ Try it online! Prints 0 for insecure prisons and the size of the input's bounding box for ...
Martin Ender's user avatar
53 votes

Is this number a prime?

Hexagony, 28 bytes Since Etoplay absolutely trounced me on this question, I felt that I had to outgolf his only other answer. ...
H.PWiz's user avatar
  • 11.6k
52 votes

Is this number a prime?

CJam, 4 bytes qimp CJam has a built-in operator for primality testing.
Peter Taylor's user avatar
  • 43.1k
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 ...
Dennis's user avatar
  • 209k
52 votes

Will it halt? (Robbers)

Malbolge, Doorknob Try it online (Thanks Dennis!) Input for Windows: F_⌠1234567890 Input on Linux based system using ISO-8559-1: ...
KBRON111's user avatar
  • 581
51 votes
Accepted

Is it almost-prime?

Sagemath, 2 bytes GF Outputs via exception. Try it online! The Sagemath builtin \$\text{GF}\$ creates a Galois Field of order \$n\$. However, remember that \$\...
Sisyphus's user avatar
  • 14.4k
50 votes

Is this number a prime?

Help, WarDoq!, 1 byte P Outputs 1 if the input is prime, 0 otherwise.
orlp's user avatar
  • 39k
50 votes

I'm a palindrome. Are you?

Python, 39 bytes lambda s:s[::-1]==s#s==]1-::[s:s adbmal Try it online! Boring, but if there is shorter in Python it will be impressive.
Jonathan Allan's user avatar
49 votes

Golf all the 16 logic gates with 2 inputs and 1 output!

Hexagony, 89 bytes Thanks to FryAmTheEggman for some necessary inspiration for the XOR solution. ...
Martin Ender's user avatar

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