Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

All Questions

Tagged with
14
votes
11answers
866 views

Source permutation

A permutation of a set \$S = \{s_1, s_2, \dotsc, s_n\}\$ is a bijective function \$\pi: S \to S\$. For example, if \$S = \{1,2,3,4\}\$ then the function \$\pi: x \mapsto 1 + (x + 1 \mod 4)\$ is a ...
26
votes
13answers
2k views

Superpermutations

Introduction You're a criminal tasked with stealing some secret plans from the new tech startup Dejavu. You sneak in over the back wall, but find a door that requires a pin to open it. You recognize ...
8
votes
4answers
177 views

Flattened Spiral Permutation Index

Context Consider square matrices with n columns and rows containing the first n^2 (i.e. n ...
11
votes
5answers
476 views

Smallest unused number sharing a factor

This is a pretty run of the mill question. I will define a sequence and you golf some code to output a entry given a index. The first item in the sequence is 2. The nth item in the sequence is the ...
12
votes
10answers
498 views

Back-To-Front Permutation Index

The Challenge Given the number of items, n, in a non-empty, sorted list output the index, i(n), at which its "Back-To-Front ...
17
votes
15answers
2k views

Compute the Eulerian number

The Eulerian number A(n, m) is the number of permutations of [1, 2, ..., n] in which exactly ...
20
votes
19answers
1k views

Rearranging the sequence

Introduction Let's observe the following sequence (non-negative integers): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ... For example, let's take the ...
17
votes
8answers
751 views

Spiral Permutation Sequence

We can roll up the natural numbers in a rectangular spiral: ...
33
votes
6answers
2k views

Can you reach this number by doubling and rearranging?

Inspired by this question on Math.SE. Starting with 1 you can repeatedly perform one of the following two operations: Double the number. or Rearrange its digits ...
13
votes
5answers
406 views

Permutations of the Fifteen Puzzle

The Challenge Consider the following diagram of the Fifteen Puzzle in its solved state: ...
7
votes
3answers
285 views

Number of ways to sum [1..n] with [n+1..2n] such that each sum is prime

Let n > 0. Let X = [1..n] and Y = [n+1 .. 2n]. Define ...
44
votes
19answers
5k views

Shotgun Numbers

The Shotgun numbers are a sequence with a rather simple definition but some interesting structure. Start with the natural numbers: ...