-
Notifications
You must be signed in to change notification settings - Fork 205
feat(OEIS): add solved conjecture for 358684 #1572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6d94348
AlphaProof proof
mo271 35d6e83
clean up proof
mo271 0d803bb
mark as solved
mo271 b8c1d0e
update number in reference
mo271 35dcfe1
add back prettified proof
mo271 45d2b68
Apply suggestions from code review
mo271 425deac
Update FormalConjectures/OEIS/358684.lean
mo271 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| /- | ||
| Copyright 2026 The Formal Conjectures Authors. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| https://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| -/ | ||
| import FormalConjectures.Util.ProblemImports | ||
|
|
||
| /-! | ||
| $a(n)$ is the minimum integer $k$ such that the smallest prime factor of the | ||
| $n$-th Fermat number exceeds $2^(2^n - k)$. | ||
|
|
||
| *References:* | ||
| - [A358684](https://oeis.org/A358684) | ||
| - [SA22](https://doi.org/10.26493/2590-9770.1473.ec5) Lorenzo Sauras-Altuzarra, *Some properties of the factors of Fermat numbers*, Art Discrete Appl. Math. (2022). | ||
| -/ | ||
|
|
||
|
|
||
| open Nat | ||
|
|
||
| /-- | ||
| A358684: $a(n)$ is the minimum integer $k$ such that the smallest prime factor of the $n$-th Fermat | ||
| number exceeds $2^{2^n - k}$. | ||
| Let $F_n = 2^{2^n} + 1$ be the $n$-th Fermat number, and $P_n$ be its smallest prime factor. | ||
| The definition of $a(n)$ is equivalent to the closed form: | ||
| $$a(n) = 2^n - \lfloor \log_2(P_n) \rfloor$$ | ||
| where $P_n = \operatorname{minFac}(\operatorname{fermatNumber} n)$. | ||
| The subtraction is defined in $\mathbb{N}$ and is safe | ||
| since $P_n \le F_n$, implying $\log_2 P_n < 2^n$. | ||
| -/ | ||
| def a (n : ℕ) : ℕ := | ||
| let pn := minFac (fermatNumber n) | ||
| (2 ^ n) - (log2 pn) | ||
|
|
||
| /-- | ||
| The "original" definition: $a'(n)$ is the minimum $k$ such that $P_n > 2^{2^n - k}$. | ||
| We use `Nat.find` which returns the smallest natural number satisfying a predicate. | ||
| -/ | ||
| noncomputable def a' (n : ℕ) : ℕ := | ||
| let Pn := minFac (fermatNumber n) | ||
mo271 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Nat.find (show ∃ k, Pn > 2 ^ (2 ^ n - k) from by | ||
| use 2^n | ||
| simp only [tsub_self, pow_zero] | ||
| simp [Pn] | ||
| unfold Nat.fermatNumber | ||
| exact (Nat.minFac_prime (by norm_num)).one_lt | ||
| ) | ||
|
|
||
| /-- | ||
| The minimization definition is equivalent to the closed form. | ||
| -/ | ||
| @[category API, AMS 11] | ||
| theorem a_equiv_a' (n : ℕ) : a n = a' n := by | ||
| sorry | ||
YaelDillies marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @[category test, AMS 11] | ||
| theorem zero : a 0 = 0 := by | ||
| simp [a] | ||
| norm_num [Nat.log2] | ||
mo271 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @[category test, AMS 11] | ||
| theorem one : a 1 = 0 := by | ||
| simp [a] | ||
| norm_num [Nat.log2] | ||
mo271 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @[category test, AMS 11] | ||
| theorem two : a 2 = 0 := by | ||
| norm_num [a] | ||
| norm_num [Nat.log2] | ||
mo271 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @[category test, AMS 11] | ||
| theorem three : a 3 = 0 := by | ||
| rw[a] | ||
| norm_num only [Nat.log2_eq_log_two,Nat.fermatNumber] | ||
mo271 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @[category test, AMS 11] | ||
| theorem four : a 0 = 0 := by | ||
| norm_num[a] | ||
| norm_num[Nat.log2] | ||
mo271 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @[category test, AMS 11] | ||
| theorem five : a 5 = 23 := by | ||
| norm_num[a] | ||
| norm_num [fermatNumber,Nat.log2_eq_log_two] | ||
mo271 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @[category test, AMS 11] | ||
| theorem six : a 6 = 46 := by | ||
| -- AlphaProof failed to close this goal | ||
| sorry | ||
|
|
||
| @[category test, AMS 11] | ||
| theorem seven : a 7 = 73 := by | ||
| sorry | ||
|
|
||
| /-- | ||
| Conjecture: the dyadic valuation of A093179(n) - 1 does not exceed 2^n - a(n). | ||
|
|
||
| A093179(n) is minFac(fermatNumber n), the smallest prime factor of the n-th Fermat number. | ||
| The conjecture states that if $P_n$ is the smallest prime factor of the $n$-th Fermat number, | ||
| then $\nu_2(P_n - 1) \le 2^n - a(n)$. | ||
| Substituting the definition of $a(n)$, this is equivalent to $\nu_2(P_n - 1) \le \lfloor \log_2(P_n) \rfloor$. | ||
|
|
||
| This is Conjecture 3.4 in [SA22]. | ||
| -/ | ||
| @[category research solved, AMS 11] | ||
| theorem oeis_358684_conjecture_0 (n : ℕ) : | ||
| padicValNat 2 (minFac (fermatNumber n) - 1) ≤ 2 ^ n - a n := by | ||
mo271 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
mo271 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| delta fermatNumber and a | ||
| rw [Nat.sub_sub_self] | ||
| · rw [Nat.log2_eq_log_two] | ||
| apply Nat.le_log_of_pow_le (by decide) | ||
| refine le_trans ?_ <| sub_le _ 1 | ||
| apply Nat.ordProj_le 2 | ||
| exact Nat.sub_ne_zero_of_lt (Nat.minFac_prime (by norm_num)).one_lt | ||
| · rw [Nat.log2_eq_log_two] | ||
| have : (2 ^ 2 ^ n) + 1 < 2 ^ ((2 ^ n) + 1) := by | ||
| simp [pow_add, mul_two] | ||
| refine Nat.le_of_lt_succ <| (2).log_lt_of_lt_pow ?_ ?_ | ||
| · exact Nat.minFac_pos _|>.ne' | ||
| · exact (Nat.minFac_le (by bound)).trans_lt this | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.