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]...
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: ...
34
votes
What are the five most powerful characters in your language?
05AB1E, 27 38 41 numbers
4·>Ìn
Generates the unique numbers:
...
33
votes
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.)
...
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.
...
31
votes
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 ...
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 ...
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 ...
23
votes
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 ...
21
votes
Hidden Inversions (Robbers' Thread)
Python 3, 46 bytes, Lynn
lambda x0223334566789:(x0223334566789*89)//178
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
...
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 ...
20
votes
Deranged !Combinatorics: Compute the Subfactorial
Funciton, 336 bytes
Byte count assumes UTF-16 encoding with BOM.
...
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!
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 ...
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.
...
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 ...
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 ...
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 ...
17
votes
The Permutation Pigeon-hole Principle
Brachylog, 21 bytes
:1fz:da|,[]
:2a#d
:Am
Try it online!
Try it online!
Predicate 0 (main predicate)
...
17
votes
Sheffle tho vawols ureund!
R, 92 91
Can't comment yet so I'm adding my own answer albeit very similar to @Andreï Kostyrka answer (believe it or not but came up with it independently).
...
17
votes
Accepted
Find a binary needle in a decimal haystack
05AB1E, 10 8 bytes
Takes the needle in binary to save 1 byte.
-2 bytes thanks to Emigna
œJÙʒbŒIå
Try it online!
...
16
votes
Accepted
16
votes
Greater than less than greater than something fishy
CJam, 16 bytes
l_,),.\'</Wf%'<*
Try it online!
A port of my Retina answer.
Explanation
...
16
votes
16
votes
What are the five most powerful characters in your language?
Brachylog, 26 numbers
3+*^-
This outputs the following numbers: ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
permutations × 202code-golf × 171
combinatorics × 40
string × 36
math × 26
sequence × 19
array × 19
number × 18
code-challenge × 15
random × 11
decision-problem × 10
sorting × 10
cops-and-robbers × 10
quine × 9
fastest-code × 7
integer × 6
source-layout × 6
abstract-algebra × 6
number-theory × 5
game × 5
restricted-complexity × 5
graph-theory × 4
palindrome × 4
arithmetic × 3
grid × 3