Questions tagged [combinatorics]
For challenges involving combinatorics.
392 questions
9
votes
2
answers
343
views
Putting the pieces together
In this code-golf challenge, you will count the number of ways of putting together pieces of a building toy which consists of slotted squares that interlock with one another, shown below. In ...
9
votes
1
answer
384
views
Ruler-and-compass constructions
In this code-golf challenge, you will work with a construction that was used by the ancient Greeks: the straightedge-and-compass construction. In particular, you will count how many different ...
4
votes
1
answer
288
views
Find the factor to use for shortest simple Brainfuck data initialization loop
I like writing answers using Brainfuck, since this language basically simulates a Turing machine, and it is pretty challenging to find the shortest answer for any problem, since there are a lot of ...
16
votes
17
answers
1k
views
Counting Gessel walks
OEIS A135404 gives the number of Gessel walks \$g(n)\$ of length \$2n\$. A Gessel walk is
a walk on the square lattice starting and ending at the origin
with possible steps (1,0), (-1,0), (1,1), (-1,-...
12
votes
7
answers
2k
views
Do Not Find the Fox in all possible ways
Do Not Find the Fox is a non-game where you repeat the following up to 16 times:
Pick an empty square in a 4×4 grid
Draw a tile from a bag – there are 5 Fs, 6 Os and 5 Xs at first – and place it in ...
7
votes
9
answers
1k
views
Card-Jitsu Part 1: Find all winning sets of three cards
Part 2 is available here
Card-Jitsu was a mini card-game based on Rock, Paper, Scissors available on the children MMO game Club Penguin. I first wrote a challenge where you needed to implement a clone ...
16
votes
12
answers
993
views
Repetition-restricted strings
Given an alphabet size, \$n>0\$, and an occurrence limit, \$k>0\$, produce the number, \$a(n, k)\$, of strings that may be constructed from the \$n\$ letters in the alphabet which have no more ...
15
votes
9
answers
1k
views
How many chains?
Given a positive integer \$n\$, a partition of \$n\$ is an ascending sequence of numbers that sum to \$n\$.
Given two partitions \$a\$ and \$b\$, \$a\$ is a refinement of \$b\$ iff \$b\$ can be ...
13
votes
13
answers
2k
views
Meandering over ℤ
The easiest way to understand this task is to look at this
graph,
which you can change interactively.
It defines a sequence n -> a(n) like this:
a(0) = 0; thereafter a(n) is the least integer (in ...
14
votes
11
answers
1k
views
Counting Rota-Baxter words
A Rota-Baxter word, \$w\$, is a string made of the symbols a, (, and ) such that the ...
8
votes
6
answers
1k
views
Ranking of binary trees
Let N = [0,1,2,...n-1] be the initial segment of the natural
numbers of length n, then all permutations of N can be sorted
lexicographically, starting with the identity. The index into this
sorted ...
2
votes
11
answers
824
views
Climbing through the mountains on all paths
Narrative
We are standing at the foot of a mountain. To find the best route when climbing the mountain, let's consider all possible routes.
On our route, there is no point lower than our starting ...
11
votes
6
answers
1k
views
Tracing light through a house of mirrors
Suppose you find yourself in a house of mirrors! You stand in the corner, and you trace how your image reflects off of mirror A, followed by mirror B, followed by mirror C, followed by mirror A.
But ...
15
votes
10
answers
2k
views
Walks in Nice (Nizza)
Narrative
Recently, I visited Nice (a French city on the Mediterranean coast) and saw a curious tourist wandering through the city. His walk started at the center of the 'Promenade des Anglais'. He ...
12
votes
6
answers
2k
views
Frogs on lily pads want to make a party
Consider binary strings (reading from left to right) starting with a '1' as ponds of lily pads. A '1' signifies a frog sitting on the lily pad, and a '0' represents an empty lily pad.
Here, we see a ...