Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.
42 votes

What are the five most powerful characters in your language?

Python3, 21 27 values Characters: 3479% Unique numbers: [1,2,3,4,5,6,7,8,9,11,12,19,20,21,24,29,34,35,36,37,39,43,46,47,49,73,74]...
user avatar
  • 3,722
34 votes
Accepted

The 9 Billion Names of God

Ruby, 46 ?A.upto(?M*9){|s|s[/(.)\1{3}|[N-Z]/]||puts(s)} My original, similar solution was longer and wrong (it output base13 numbers, which isn't quite all of ...
user avatar
  • 21.9k
34 votes

What are the five most powerful characters in your language?

Python, 18 numbers 237#- Produces as valid results: 1, 2, 3, 4, 5, 7, 16, 23, 24, 25, 27, 32, 35, 37, 69, 71, 72, 73 EDIT: ...
user avatar
  • 11.7k
34 votes

What are the five most powerful characters in your language?

05AB1E, 27 38 41 numbers 4·>Ìn Generates the unique numbers: ...
user avatar
  • 51.7k
33 votes

Golf bit weaving

Python 2.7, 44 -> 36 bytes lambda x:x/4&42|x*2&128|x*4&84|x/2&1
user avatar
  • 1,241
32 votes

Greater than less than greater than something fishy

Retina, 20 bytes Byte count assumes ISO 8859-1 encoding. $.' S`> %O#`\d+ ¶ > Try it online! (The first line enables a linefeed-separated test-suite.) ...
user avatar
31 votes

Anaglot Polygrams

34 Languages, 19 bytes, Score: 38,832,018,459,912,437,760,000 Here is a quick answer I threw together to show that it is possible to get an answer scoring better than 1. ...
user avatar
  • 85.1k
31 votes

Golf an Anagram Quine

Pyth, 2 bytes )( Outputs () Try it online! ...
user avatar
  • 18.1k
27 votes

Greater than less than greater than something fishy

><>, 46 43 35 + 4 for  -s= = 39 bytes 0&l?!v:3%?\&:n1+$o! +nf0.>&n; >l&:@ This is an ...
user avatar
  • 3,749
25 votes

Greater than less than greater than something fishy

><>, 26 + 4 = 30 bytes l22pirv 1+$2po>:3%::2g:n$- Try it online! +4 bytes for the -s= flag - if just ...
user avatar
  • 60.9k
24 votes

The 9 Billion Names of God

C 140 177 235 Good old procedural style, no fancyness. It counts (no write) 11,459,252,883 names in 8 minutes. Next edit with the runtime and size of names file. Watch the sky... Runtime 57 minutes,...
user avatar
  • 31.8k
24 votes

What are the five most powerful characters in your language?

Java 8, 2 4 numbers n->12 // returns 12 n->21 // returns 21 n1->2 // returns 2 n2->1 // returns 1 Weren't expecting a Java answer, were you? This ...
user avatar
  • 1,286
23 votes

Alphabetically permute a string

Jelly, 5 bytes ṢŒ!QY Try it online! Explanation ...
user avatar
  • 99.4k
23 votes

Levi-Civita symbol

Jelly, 5 bytes ṁ4IṠS Try it online! Algorithm Let's consider the differences j-i, k-j, i-k. If (i, j, k) is a rotation of (1, 2, 3), the differences are a ...
user avatar
  • 206k
21 votes

Random Golf of the Day #1: Shuffle an Array

Dyalog APL, 25 24 bytes First for the 25-character solution: i{⊃a[⍺⍵]←a[⍵⍺]}¨?i←⌽⍳⍴a←⎕ ...
user avatar
  • 14.5k
21 votes

Shotgun Numbers

><>, 52 45 bytes Esolangs page for ><> i:&&:&1-?vn; 2*1-*+20.>:&:&%1(&:&*{:}&:1-&,2% There's a lot of copying and ...
user avatar
  • 60.9k
21 votes

Hidden Inversions (Robbers' Thread)

Python 3, 46 bytes, Lynn lambda x0223334566789:(x0223334566789*89)//178
user avatar
  • 17.8k
21 votes
Accepted

Ethan Finds the Maximum Element

APL (Dyalog Unicode), 5 3 bytes ⍳⊥× Try it online! Adám gave me an inspiration to golf this further. How it works ...
user avatar
  • 62.2k
20 votes
Accepted

The Combinatorics of Transistor

CJam (56 bytes) q~4@:Nm*:$_&{:+1$\-N),&},f{1$1$:+-\0-:(_e`0f=+++:m!:/}:+ Online demo This is an optimised version of the reference implementation I ...
user avatar
  • 42.8k
20 votes

Output an Anagram! No Not That One!

Python 3, 64 bytes lambda a:[*{*permutations(a[0])}-{*a}][0] from itertools import* Try it online!
user avatar
  • 41.4k
19 votes

The 9 Billion Names of God

Golfscript, 58 47 characters "A"13 9?,{13base{65+}%n+}%{`{\4*/,}+78,1/%1-!}, Thanks to Peter Taylor, I am spared from the seppuku from not beating the Ruby ...
user avatar
  • 3,970
19 votes

Faro shuffle an array

vim, 62 59 54 qrma50%mb:norm@q<cr>ggqOjdd'apjma'b@q<esc>0"qDJ<C-a>D@"i@r<esc>xxdd@" Wow. This is possibly the hackiest thing I've written ...
user avatar
  • 70.5k
19 votes

Antsy permutations

Pyth, 7 bytes /y+_QQS Try it online. (Only small test cases are included due to exponential run-time.) Outputs 2 for Truthy, 0 for Falsey. ...
user avatar
  • 137k
19 votes

Deranged !Combinatorics: Compute the Subfactorial

Funciton, 336 bytes Byte count assumes UTF-16 encoding with BOM. ...
user avatar
19 votes

Counting from 1 to n without any consecutive numbers

Mathematica, 58 bytes, polynomial(n) time Abs[Sum[(k-1)Hypergeometric2F1[k,k-#,2,2](#-k)!,{k,#}]-1]& How it works Rather than iterating over permutations ...
user avatar
19 votes

Ethan Finds the Maximum Element

Jelly, 6 bytes RU×\S: Try it online! Let's analyze under which scenarios this algorithm works. If the maximum element is at the end of the list, this obviously ...
user avatar
  • 40.2k
18 votes

The 9 Billion Names of God

Bash+Linux command line utils, 43 bytes jot -w%x $[16**9]|egrep -v "[0ef]|(.)\1{3}" This uses a similar technique to my answer below, but just counts in ...
user avatar
18 votes
Accepted

Can you reach this number by doubling and rearranging?

Pyth, 43 bytes ?}QKhu?Jf}QTGJsm+Ld+yedsMfnhT\0.p`edGQ]]1KY Demonstration. This is starts by generating all possible double or rearrange sequences. However, ...
user avatar
  • 41.3k
17 votes

Code-Golf: Permutations

Python, 52 Input is a set. Output is a list of lists. f=lambda a:[p+[x]for x in a for p in f(a-{x})]or[[]] This is shorter than the answer that does all the work ...
user avatar
  • 30.9k

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