Fibonacci-sum permutations with only one way
Fill spots 1 to k with 1 to k, one each, so each number plus its spot is a Fibonacci number: 1, 2, then each the sum of the two before. Exactly one way works precisely when k is on Layman's list 1, 2, 3, 5, 9, …
For every k ≥ 1, there is exactly one way to put the numbers 1, 2, …, k into spots 1, 2, …, k, one in each spot, so that every number plus the number of its spot is a Fibonacci number, precisely when k is on Layman's list 1, 2, 3, 5, 9, 15, 24, 39, …, which starts w₁ = 1, w₂ = 2 and continues wₙ = F(n + 2) − wₙ₋₂ − 1 for n ≥ 3, where F(n) is the n-th Fibonacci number (F(1) = F(2) = 1).
Layman listed these numbers in the On-Line Encyclopedia of Integer Sequences (A097083) in 2004 as the k with exactly one arrangement, and the formula for them was conjectured there. Hajnal (2022) proved that any other k ≥ 1 has at least two arrangements, and wrote that the hard part is to show that a number on the list has just one. Lean checked both halves: every number on the list has exactly one way, and no other positive number does.
One way for 5, two ways for 4 and for 6
Take k = 5. A sum of a number and its spot is at most 10, so the only possible sums are 2, 3, 5 and 8.
Spot 5 needs a sum from 6 to 10, so the sum is 8 and spot 5 holds 3. Spot 2 needs sum 3 or 5, so it holds 1 or 3, and 3 is taken, so it holds 1. Spot 4 needs sum 5 or 8, so it holds 1 or 4, and 1 is taken, so it holds 4. Spot 1 needs sum 2, 3 or 5, so it holds 1, 2 or 4, and only 2 is free. Spot 3 gets the 5 that is left.
The only arrangement is 2 1 5 4 3, with sums 3, 3, 8, 8, 8. And 5 is on the list: w₄ = F(6) − w₂ − 1 = 8 − 2 − 1 = 5.
For k = 4, which is not on the list, there are two: 1 3 2 4 and 4 3 2 1. For k = 6, also not on the list, there are two: 1 6 5 4 3 2 and 4 6 5 1 3 2. They differ only in spots 1 and 4.
For k = 24 = w₇ the one arrangement is built in blocks. Spots 10 to 24 hold the numbers 24 down to 10, every sum being 34. Spots 1 to 9 hold the one arrangement for k = 9, which is 1 3 2 9 8 7 6 5 4. Its spots 4 to 9 all have sum 13, and its spots 1 to 3 hold the one arrangement for k = 3.
The puzzle and the list
An arrangement puts the numbers 1 to k into spots 1 to k, one in each spot. It is valid if every number plus its spot number is a Fibonacci number, and a(k) counts the valid arrangements. Layman's list is defined by w₁ = 1, w₂ = 2 and wₙ = F(n + 2) − wₙ₋₂ − 1 for n ≥ 3. Swapping the roles of numbers and spots turns a valid arrangement into a valid arrangement.
- The number of valid arrangements
- Being a Fibonacci number
- A valid arrangement
- Layman's list
- Hajnal's sums
Swapping numbers and spots keeps it valid
If an arrangement is valid, so is the one that swaps the roles of numbers and spots.
theorem FibSumPerm.IsValidFibPerm.symm {k : ℕ} {p : Equiv.Perm (Fin k)} (hp : IsValidFibPerm k p) : IsValidFibPerm k (Equiv.symm p)- Only finitely many places to look
- A test for being a Fibonacci number
- A test for being valid
- The empty arrangement
- Being a Fibonacci number
- A valid arrangement
- The number of valid arrangements
- Layman's list
- Hajnal's sums
The gaps between Fibonacci numbers
Between one Fibonacci number and the next there is no other, so a Fibonacci number strictly between F(a) and F(a + 2) can only be F(a + 1). Every k ≥ 1 has an index j ≥ 3 with F(j) ≤ 2k < F(j + 1). For n ≥ 1 the number wₙ lies between F(n + 1) and F(n + 2), and for every n ≥ 0 the list satisfies wₙ + wₙ₊₂ + 1 = F(n + 4).
Trapped between two, it must be the middle one
A positive Fibonacci number strictly between F(a) and F(a + 2) equals F(a + 1).
theorem FibSumPerm.eq_fib_of_isFib_between (a : ℕ) (m : ℕ) (hm : IsFib m) (h1 : Nat.fib a < m) (h2 : m < Nat.fib (a + 2)) : m = Nat.fib (a + 1)
- Nothing between neighbours
Every k has its Fibonacci size
For every k ≥ 1 there is a j ≥ 3 with F(j) ≤ 2k < F(j + 1).
theorem FibSumPerm.exists_fib_scale {k : ℕ} (hk : 1 ≤ k) : ∃ j, 3 ≤ j ∧ Nat.fib j ≤ 2 * k ∧ 2 * k < Nat.fib (j + 1)Where Layman's numbers sit
For every n ≥ 1, F(n + 1) ≤ wₙ, wₙ + 1 ≤ F(n + 2), and F(n + 2) ≤ 2wₙ < F(n + 3).
theorem FibSumPerm.w_bounds (n : ℕ) (hn : 1 ≤ n) : Nat.fib (n + 1) ≤ w n ∧ w n + 1 ≤ Nat.fib (n + 2) ∧ Nat.fib (n + 2) ≤ 2 * w n ∧ 2 * w n < Nat.fib (n + 3)
The list two steps apart
For every n ≥ 0, wₙ + wₙ₊₂ + 1 = F(n + 4).
theorem FibSumPerm.w_add_w_add_one (n : ℕ) : w n + w (n + 2) + 1 = Nat.fib (n + 4)
- A slightly sharper upper bound
- From F(2) on, the sequence strictly grows
- Each Fibonacci number is the sum of the two before it
- Fibonacci numbers are positive
- F(j) counts as a Fibonacci number
- A simple lower bound for F(j)
Flip the top block
Take a Fibonacci number s with k < s ≤ 2k. Reversing the block of spots from s − k to k makes every sum there equal to s. The spots below it can hold any valid arrangement of 1 to s − k − 1. So every k has at least one valid arrangement, and if two different Fibonacci numbers are larger than k and at most 2k, there are at least two.
Flipping a block never loses arrangements
If s is a Fibonacci number with k < s ≤ 2k, then a(s − k − 1) ≤ a(k).
theorem FibSumPerm.extension_count_ge {k : ℕ} {s : ℕ} (hs : IsFib s) (hks : k < s) (hs2k : s ≤ 2 * k) : fibPermCount (s - k - 1) ≤ fibPermCount k- The flip rule
- The flipped arrangement
- What the last spot holds
- Different small arrangements give different large ones
The flipped arrangement is valid
If s is a Fibonacci number with k < s ≤ 2k and the arrangement of 1 to s − k − 1 is valid, then the flipped arrangement of 1 to k is valid.
theorem FibSumPerm.extendPerm_valid {k : ℕ} {s : ℕ} (hs : IsFib s) (hks : k < s) (hs2k : s ≤ 2 * k) {q : Equiv.Perm (Fin (s - k - 1))} (hq : IsValidFibPerm (s - k - 1) q) : IsValidFibPerm k (extendPerm k s hks hs2k q)There is always an arrangement
For every k ≥ 0, there is at least one valid arrangement of 1 to k.
theorem FibSumPerm.fibPermCount_pos (k : ℕ) : 1 ≤ fibPermCount k
Two Fibonacci numbers give two arrangements
If two different Fibonacci numbers are above k and at most 2k, then there are at least two valid arrangements of 1 to k.
theorem FibSumPerm.two_le_fibPermCount_of_two_fibs {k : ℕ} {s₁ : ℕ} {s₂ : ℕ} (hs₁ : IsFib s₁) (hs₂ : IsFib s₂) (hk1 : k < s₁) (h12 : s₁ < s₂) (h2k : s₂ ≤ 2 * k) : 2 ≤ fibPermCount k
The step from a small puzzle to a larger one
Let j ≥ 3 and take four Fibonacci numbers in a row, I = F(j), H, G and F = F(j + 3). Suppose t ≥ 1, H ≤ 2t < G, and the small puzzle on 1 to t has exactly one valid arrangement, in which no sum equals I. Then the larger puzzle on 1 to k = F − 1 − t, when G ≤ k and 2k < F + G, also has exactly one, and no sum in it equals G. Any other arrangement would take a detour, with a low spot holding a number from the middle block H to G, and such a detour could be closed up into a valid small arrangement that does use the sum I, which is a contradiction.
The step lemma
Let j ≥ 3 and name four Fibonacci numbers in a row: I = F(j), H = F(j + 1), G = F(j + 2) and F = F(j + 3) (the bare letter F, with nothing in brackets, means this last one). Suppose G ≤ k, 2k < F + G, t = F − 1 − k ≥ 1, H ≤ 2t < G, and that 1 to t has exactly one valid arrangement, in which the sum I never appears. Then 1 to k has exactly one valid arrangement, and the sum G never appears in it.
theorem FibSumPerm.step_lemma {j : ℕ} {k : ℕ} {t : ℕ} (hj : 3 ≤ j) (hGk : Nat.fib (j + 2) ≤ k) (hkFG : 2 * k < Nat.fib (j + 3) + Nat.fib (j + 2)) (ht : t = Nat.fib (j + 3) - 1 - k) (ht1 : 1 ≤ t) (_hHt : Nat.fib (j + 1) ≤ 2 * t) (htG : 2 * t < Nat.fib (j + 2)) (huniq : fibPermCount t = 1) (hnoI : ∀ (q : Equiv.Perm (Fin t)), IsValidFibPerm t q → ∀ (i : Fin t), ↑i + 1 + (↑(q i) + 1) ≠ Nat.fib j) : fibPermCount k = 1 ∧ ∀ (p : Equiv.Perm (Fin k)), IsValidFibPerm k p → ∀ (i : Fin k), ↑i + 1 + (↑(p i) + 1) ≠ Nat.fib (j + 2)
Climbing Layman's list
The claim proved for every n ≥ 1 is stronger than uniqueness. There is exactly one valid arrangement for wₙ, and it never uses the sum F(n + 1). The cases n = 1, 2, 3 are settled directly. For n ≥ 4 the step lemma carries the claim from wₙ₋₂ to wₙ.
Exactly one arrangement, and one sum never used
For every n ≥ 1, there is exactly one valid arrangement of 1 to wₙ, and no sum in it equals F(n + 1).
theorem FibSumPerm.layman_unique_strong (n : ℕ) (hn : 1 ≤ n) : fibPermCount (w n) = 1 ∧ ∀ (p : Equiv.Perm (Fin (w n))), IsValidFibPerm (w n) p → ∀ (i : Fin (w n)), ↑i + 1 + (↑(p i) + 1) ≠ Nat.fib (n + 1)
Every number on the list has exactly one arrangement
For every n ≥ 1, there is exactly one valid arrangement of 1 to wₙ.
theorem FibSumPerm.layman_unique_if (n : ℕ) (hn : 1 ≤ n) : fibPermCount (w n) = 1
- One arrangement for k = 1
- The valid arrangement for k = 2
- One arrangement for k = 2
- No sum 2 for k = 2
- The valid arrangement for k = 3
- One arrangement for k = 3
- No sum 3 for k = 3
- One arrangement for k = 5
No other k has exactly one
Suppose k ≥ 1 has exactly one valid arrangement. If k is larger than 2, the smaller puzzle of size t = F(j) − k − 1 also has exactly one, where F(j) ≤ 2k < F(j + 1). By induction t is on Layman's list, and size estimates leave just one possible place on it, except for k = 6 and k = 10. Those two are ruled out by showing two arrangements, so k is on the list, as Hajnal (2022) proved.
Only numbers on the list have exactly one
For every k ≥ 1, if there is exactly one valid arrangement of 1 to k, then k = wₙ for some n ≥ 1.
theorem FibSumPerm.layman_unique_only_if (k : ℕ) (hk : 1 ≤ k) (huniq : fibPermCount k = 1) : ∃ n, 1 ≤ n ∧ k = w n
Two arrangements for k = 6
a(6) = 2. The proof shows the two are 1 6 5 4 3 2 and 4 6 5 1 3 2.
theorem FibSumPerm.fibPermCount_six : fibPermCount 6 = 2
At least two arrangements for k = 10
a(10) ≥ 2.
theorem FibSumPerm.two_le_fibPermCount_ten : 2 ≤ fibPermCount 10
- Two arrangements for k = 4
- The arrangement 4 3 2 1
- The arrangement 1 6 5 4 3 2
- The arrangement 4 6 5 1 3 2
- The arrangement 2 1 10 9 8 7 6 5 4 3
- The arrangement 7 6 10 9 8 2 1 5 4 3
Both directions, and two other ways to write the list
The two directions together say that, for k ≥ 1, there is exactly one valid arrangement precisely when k is on Layman's list. The list can also be written as Hajnal's sums F(l) + F(l − 4) + …, and as F(n + 3) divided by √5 and rounded down, for n ≥ 1. The rounded formula follows from exact whole-number identities, by squeezing F(n + 3)² between 5wₙ² and 5(wₙ + 1)².
Exactly one arrangement, precisely on Layman's list
For every k ≥ 1, there is exactly one valid arrangement of 1 to k if and only if k = wₙ for some n ≥ 1.
theorem FibSumPermChallenge.hajnal_conjecture_1 (k : ℕ) (hk : 1 ≤ k) : fibPermCount k = 1 ↔ ∃ n, 1 ≤ n ∧ k = w n
Every number on the list has exactly one arrangement
For every n ≥ 1, there is exactly one valid arrangement of 1 to wₙ.
theorem FibSumPermChallenge.layman_unique_if (n : ℕ) (hn : 1 ≤ n) : fibPermCount (w n) = 1
The same theorem with Hajnal's sums
For every k ≥ 1, there is exactly one valid arrangement of 1 to k if and only if k = M₄(l) for some l ≥ 2.
theorem FibSumPermChallenge.hajnal_conjecture_1_M4 (k : ℕ) (hk : 1 ≤ k) : fibPermCount k = 1 ↔ ∃ l, 2 ≤ l ∧ k = M4 l
A closed formula for the list
For every n ≥ 1, wₙ is F(n + 3) divided by √5, rounded down.
theorem FibSumPermChallenge.w_eq_floor_fib_div_sqrt5 (n : ℕ) (hn : 1 ≤ n) : ↑(w n) = ⌊↑(Nat.fib (n + 3)) / √5⌋
Exactly one arrangement, precisely on Layman's list
For every k ≥ 1, there is exactly one valid arrangement of 1 to k if and only if k = wₙ for some n ≥ 1.
theorem FibSumPerm.hajnal_conjecture_1 (k : ℕ) (hk : 1 ≤ k) : fibPermCount k = 1 ↔ ∃ n, 1 ≤ n ∧ k = w n
The same theorem with Hajnal's sums
For every k ≥ 1, there is exactly one valid arrangement of 1 to k if and only if k = M₄(l) for some l ≥ 2.
theorem FibSumPerm.hajnal_conjecture_1_M4 (k : ℕ) (hk : 1 ≤ k) : fibPermCount k = 1 ↔ ∃ l, 2 ≤ l ∧ k = M4 l
Hajnal's sums are Layman's numbers
For every n ≥ 1, M₄(n + 1) = wₙ.
theorem FibSumPerm.M4_eq_w (n : ℕ) (hn : 1 ≤ n) : M4 (n + 1) = w n
- The list four steps apart
A closed formula for the list
For every n ≥ 1, wₙ is F(n + 3) divided by √5, rounded down.
theorem FibSumPerm.w_eq_floor_fib_div_sqrt5 (n : ℕ) (hn : 1 ≤ n) : ↑(w n) = ⌊↑(Nat.fib (n + 3)) / √5⌋
The square squeeze
For every n ≥ 1, 5wₙ² < F(n + 3)² < 5(wₙ + 1)².
theorem FibSumPerm.w_sq_sandwich (n : ℕ) (hn : 1 ≤ n) : 5 * w n ^ 2 < Nat.fib (n + 3) ^ 2 ∧ Nat.fib (n + 3) ^ 2 < 5 * (w n + 1) ^ 2
Lucas numbers sit just above 5wₙ
For every n ≥ 1, Lₙ₊₃ is between 5wₙ + 1 and 5wₙ + 4.
theorem FibSumPerm.lucas_sandwich_w (n : ℕ) (hn : 1 ≤ n) : 5 * w n + 1 ≤ lucas (n + 3) ∧ lucas (n + 3) ≤ 5 * w n + 4
Squares of Lucas and Fibonacci numbers
Lₘ² − 5F(m)² is 4 when m is even and −4 when m is odd.
theorem FibSumPerm.lucas_sq_sub_five_fib_sq (m : ℕ) : ↑(lucas m) ^ 2 - 5 * ↑(Nat.fib m) ^ 2 = 4 * (-1) ^ m
- Cassini's identity
- Lucas numbers four steps apart
- Lucas numbers from Fibonacci numbers
- The Lucas numbers
- The two counts agree
- The two versions of Layman's list agree
- The two versions of Hajnal's sums agree