Smarandache permutation sequence
DefinitionBlocks of the Smarandache permutation sequence#✓fully proved
For a natural number \(n\), the \(n\)-th block is the list of the odd numbers \(1, 3, \ldots, 2n - 1\) in increasing order followed by the even numbers \(2n, 2n - 2, \ldots, 2\) in decreasing order; the \(0\)-th block is empty.
def smarandacheBlock (n : ℕ) : List ℕ :=
((List.range n).map (fun k => 2 * k + 1)) ++ ((List.range n).map (fun k => 2 * (n - k)))
DefinitionPrefix of the Smarandache permutation sequence#✓fully proved
For a natural number \(N\), this is the list of natural numbers obtained by concatenating, in order, the Smarandache blocks numbered \(1, 2, \dots, N\), where block \(n\) is the list \((1, 3, \dots, 2n - 1, 2n, 2n - 2, \dots, 2)\) of the odd numbers below \(2n\) in increasing order followed by the even numbers from \(2n\) down to \(2\). For \(N = 0\) it is the empty list.
def smarandachePrefix (N : ℕ) : List ℕ :=
((List.range N).map (fun n => smarandacheBlock (n + 1))).flatten
def smarandacheBlock (n : ℕ) : List ℕ :=
((List.range n).map (fun k => 2 * k + 1)) ++ ((List.range n).map (fun k => 2 * (n - k)))
MathlibExt/Combinatorics/Enumerative/SmarandachePermutationSequence.lean:35
Uses 1 · Used by 2
DefinitionSmarandache permutation sequence#✓fully proved
The Smarandache permutation sequence (OEIS A004741) is the sequence \((a_i)_{i \ge 0}\) of natural numbers, indexed from \(0\), obtained by concatenating the blocks \((1, 3, \ldots, 2n - 1, 2n, 2n - 2, \ldots, 2)\) for \(n = 1, 2, 3, \ldots\) in order; it begins \(1, 2, 1, 3, 4, 2, 1, 3, 5, 6, 4, 2, \ldots\), so \(a_0 = 1\).
def smarandachePermutation (i : ℕ) : ℕ :=
(smarandachePrefix (i + 1)).getD i 0
def smarandachePrefix (N : ℕ) : List ℕ :=
((List.range N).map (fun n => smarandacheBlock (n + 1))).flatten
MathlibExt/Combinatorics/Enumerative/SmarandachePermutationSequence.lean:41
TheoremFirst block of the Smarandache permutation sequence#✓fully proved
The first block of the Smarandache permutation sequence is \((1, 2)\).
theorem smarandacheBlock_one : smarandacheBlock 1 = [1, 2]
def smarandacheBlock (n : ℕ) : List ℕ :=
((List.range n).map (fun k => 2 * k + 1)) ++ ((List.range n).map (fun k => 2 * (n - k)))
MathlibExt/Combinatorics/Enumerative/SmarandachePermutationSequence.lean:35
Uses 1
TheoremSecond block of the Smarandache permutation sequence#✓fully proved
The second block of the Smarandache permutation sequence is \((1, 3, 4, 2)\).
theorem smarandacheBlock_two : smarandacheBlock 2 = [1, 3, 4, 2]
def smarandacheBlock (n : ℕ) : List ℕ :=
((List.range n).map (fun k => 2 * k + 1)) ++ ((List.range n).map (fun k => 2 * (n - k)))
MathlibExt/Combinatorics/Enumerative/SmarandachePermutationSequence.lean:35
Uses 1
TheoremThird block of the Smarandache permutation sequence#✓fully proved
The third block of the Smarandache permutation sequence is \((1, 3, 5, 6, 4, 2)\).
theorem smarandacheBlock_three : smarandacheBlock 3 = [1, 3, 5, 6, 4, 2]
def smarandacheBlock (n : ℕ) : List ℕ :=
((List.range n).map (fun k => 2 * k + 1)) ++ ((List.range n).map (fun k => 2 * (n - k)))
MathlibExt/Combinatorics/Enumerative/SmarandachePermutationSequence.lean:35
Uses 1
TheoremFourth block of the Smarandache permutation sequence#✓fully proved
The fourth block of the Smarandache permutation sequence is \((1, 3, 5, 7, 8, 6, 4, 2)\).
theorem smarandacheBlock_four :
smarandacheBlock 4 = [1, 3, 5, 7, 8, 6, 4, 2]
def smarandacheBlock (n : ℕ) : List ℕ :=
((List.range n).map (fun k => 2 * k + 1)) ++ ((List.range n).map (fun k => 2 * (n - k)))
MathlibExt/Combinatorics/Enumerative/SmarandachePermutationSequence.lean:35
Uses 1
TheoremConcatenation of the first three Smarandache blocks#✓fully proved
Concatenating the first three blocks of the Smarandache permutation sequence gives \((1, 2, 1, 3, 4, 2, 1, 3, 5, 6, 4, 2)\).
theorem smarandachePrefix_three :
smarandachePrefix 3 = [1, 2, 1, 3, 4, 2, 1, 3, 5, 6, 4, 2]
def smarandachePrefix (N : ℕ) : List ℕ :=
((List.range N).map (fun n => smarandacheBlock (n + 1))).flatten
MathlibExt/Combinatorics/Enumerative/SmarandachePermutationSequence.lean:41
Uses 1
TheoremInitial term of the Smarandache permutation sequence#✓fully proved
Indexing the Smarandache permutation sequence \((a_i)_{i \ge 0}\) from \(0\), its initial term is \(a_0 = 1\).
theorem smarandachePermutation_zero : smarandachePermutation 0 = 1
def smarandachePermutation (i : ℕ) : ℕ :=
(smarandachePrefix (i + 1)).getD i 0
MathlibExt/Combinatorics/Enumerative/SmarandachePermutationSequence.lean:49
Uses 1
TheoremSixth term of the Smarandache permutation sequence#✓fully proved
Indexing the Smarandache permutation sequence \((a_i)_{i \ge 0}\) from \(0\), its sixth term is \(a_5 = 2\).
theorem smarandachePermutation_five : smarandachePermutation 5 = 2
def smarandachePermutation (i : ℕ) : ℕ :=
(smarandachePrefix (i + 1)).getD i 0
MathlibExt/Combinatorics/Enumerative/SmarandachePermutationSequence.lean:49
Uses 1
TheoremTwelfth term of the Smarandache permutation sequence#✓fully proved
Indexing the Smarandache permutation sequence \((a_i)_{i \ge 0}\) from \(0\), its twelfth term is \(a_{11} = 2\).
theorem smarandachePermutation_eleven : smarandachePermutation 11 = 2
def smarandachePermutation (i : ℕ) : ℕ :=
(smarandachePrefix (i + 1)).getD i 0
MathlibExt/Combinatorics/Enumerative/SmarandachePermutationSequence.lean:49
Uses 1
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.