import Mathlib import LeanClassics.FibHarmonic /-! # Odd `n` dividing `∑_{i ≤ n} F_{3i}^3` Mandal and Mohan, *Integral Means of Fibonacci Numbers* (arXiv:2611.32519), Remark 1.13, ask whether infinitely many odd `n` satisfy `n ∣ ∑_{i=1}^n F_{3i}^3`. * `FibCubes.dvd_sum_cubes` is the general criterion. Suppose `n` is coprime to `10`, `F_T ≡ 0` and `F_{T+1} ≡ 1 (mod n)` (so `T` is a multiple of the Pisano period), `T` is even, `3 ∤ T` and `T ∣ n + 1`. Then `n ∣ ∑_{i=1}^n F_{3i}^3`. * `FibCubes.fib_dvd_sum_cubes` applies it to `n = F_m`. Here `m` is even, `3 ∤ m` and `2m ∣ F_m + 1`. * `FibCubes.four_mul_dvd_fib_two_mul_add_one` proves Flynn-Connolly's congruence: `4p ∣ F_{2p} + 1` for primes `p ≡ 17, 23 (mod 30)`. It works in `𝔽_p[√5]`, where `√5^p = -√5` because `(5/p) = -1`. * `FibCubes.infinite_odd_dvd_sum_cubes` combines these with Dirichlet's theorem: infinitely many odd `n` satisfy `n ∣ ∑_{i=1}^n F_{3i}^3`. Proof idea. Since `T ∣ n+1` and `F_{3(n+1)} ≡ 0`, the sum splits into whole blocks of length `T`. Because `3 ∤ T`, each block is a permutation of one full period. The identity `10 ∑_{j ≤ M+1} F_j^3 = F_{3M+5} + 6(-1)^M F_M + 5` shows that a full period of cubes sums to `0 (mod n)`. -/ namespace FibCubes open Nat Finset local notation "f" k => ((Nat.fib k : ℕ) : ℤ) theorem cassini (k : ℕ) : (f (k + 2)) * (f k) - (f (k + 1)) ^ 2 = (-1) ^ (k + 1) := by induction k with | zero => simp [fib_add_two] | succ k ih => have e2 : (f (k + 3)) = (f (k + 1)) + (f (k + 2)) := by rw [show k + 3 = (k + 1) + 2 by ring, fib_add_two]; push_cast; ring have e1 : (f (k + 2)) = (f k) + (f (k + 1)) := by rw [fib_add_two]; push_cast; ring rw [show k + 1 + 2 = k + 3 by ring, show k + 1 + 1 = k + 2 by ring, e2, pow_succ] rw [e1] at ih ⊢; linear_combination (-1 : ℤ) * ih /-- The triple-angle identity `F_{3k} = 5F_k^3 + 3(-1)^k F_k`. -/ theorem fib_three_mul (k : ℕ) : (f (3 * k)) = 5 * (f k) ^ 3 + 3 * (-1) ^ k * (f k) := by rcases k with _ | j · simp · have hA := fib_add (j + 1) j have hB := fib_add (j + 1) (j + 1) have hC := fib_add (2 * j + 2) j rw [show j + 1 + j + 1 = 2 * j + 2 by ring] at hA rw [show j + 1 + (j + 1) + 1 = 2 * j + 3 by ring] at hB rw [show 2 * j + 2 + j + 1 = 3 * (j + 1) by ring, show 2 * j + 2 + 1 = 2 * j + 3 by ring] at hC have c := cassini j have e2 : (f (j + 2)) = (f j) + (f (j + 1)) := by rw [fib_add_two]; push_cast; ring have hC' : (f (3 * (j + 1))) = (f (2 * j + 2)) * (f j) + (f (2 * j + 3)) * (f (j + 1)) := by rw [hC]; push_cast; ring have hA' : (f (2 * j + 2)) = (f (j + 1)) * (f j) + (f (j + 2)) * (f (j + 1)) := by rw [hA]; push_cast; ring have hB' : (f (2 * j + 3)) = (f (j + 1)) ^ 2 + (f (j + 2)) ^ 2 := by rw [hB]; push_cast; ring rw [hC', hA', hB', e2]; rw [e2] at c rw [pow_succ] linear_combination (3 * (f (j + 1))) * c /-- `10 ∑_{j < M+2} F_j^3 = F_{3M+5} + 6(-1)^M F_M + 5`. -/ theorem sum_cubes (M : ℕ) : 10 * ∑ j ∈ range (M + 2), (f j) ^ 3 = (f (3 * M + 5)) + 6 * (-1) ^ M * (f M) + 5 := by induction M with | zero => simp [Finset.sum_range_succ]; norm_num [fib_add_two] | succ M ih => rw [show M + 1 + 2 = (M + 2) + 1 by ring, Finset.sum_range_succ, mul_add, ih] have t := fib_three_mul (M + 2) have e8 : (f (3 * (M + 1) + 5)) = 2 * (f (3 * (M + 2))) + (f (3 * M + 5)) := by have h1 : fib (3 * M + 8) = fib (3 * M + 6) + fib (3 * M + 7) := by rw [show 3 * M + 8 = (3 * M + 6) + 2 by ring, fib_add_two] have h2 : fib (3 * M + 7) = fib (3 * M + 5) + fib (3 * M + 6) := by rw [show 3 * M + 7 = (3 * M + 5) + 2 by ring, fib_add_two] rw [show 3 * (M + 1) + 5 = 3 * M + 8 by ring, show 3 * (M + 2) = 3 * M + 6 by ring, h1, h2] push_cast; ring have e2 : (f (M + 2)) = (f M) + (f (M + 1)) := by rw [fib_add_two]; push_cast; ring rw [e8, t, pow_succ (-1 : ℤ) (M + 1), pow_succ (-1 : ℤ) M] rw [e2]; ring /-- Periodicity: if `F_T ≡ 0` and `F_{T+1} ≡ 1 (mod n)`, then `F_{j+T} ≡ F_j`. -/ theorem fib_add_period {n T : ℕ} (h0 : (fib T : ZMod n) = 0) (h1 : (fib (T + 1) : ZMod n) = 1) (j : ℕ) : (fib (j + T) : ZMod n) = fib j := by rcases j with _ | j · simpa using h0 · have := fib_add T j rw [show j + 1 + T = T + j + 1 by ring, this]; push_cast; rw [h0, h1]; ring theorem fib_add_mul_period {n T : ℕ} (h0 : (fib T : ZMod n) = 0) (h1 : (fib (T + 1) : ZMod n) = 1) (j c : ℕ) : (fib (j + c * T) : ZMod n) = fib j := by induction c with | zero => simp | succ c ih => rw [show j + (c + 1) * T = (j + c * T) + T by ring, fib_add_period h0 h1, ih] theorem fib_mod_period {n T : ℕ} (h0 : (fib T : ZMod n) = 0) (h1 : (fib (T + 1) : ZMod n) = 1) (j : ℕ) : (fib j : ZMod n) = fib (j % T) := by conv_lhs => rw [← Nat.mod_add_div j T, mul_comm] exact fib_add_mul_period h0 h1 _ _ /-- **Criterion.** Let `n` be coprime to `10`. Suppose `F_T ≡ 0` and `F_{T+1} ≡ 1 (mod n)`, with `T ≥ 2` even, `3 ∤ T` and `T ∣ n + 1`. Then `n ∣ ∑_{i=1}^n F_{3i}^3`. -/ theorem dvd_sum_cubes {n T : ℕ} (hcop : Nat.Coprime n 10) (hT2 : 2 ≤ T) (hTe : Even T) (hT3 : ¬ 3 ∣ T) (hTn : T ∣ n + 1) (h0 : (fib T : ZMod n) = 0) (h1 : (fib (T + 1) : ZMod n) = 1) : n ∣ ∑ i ∈ Icc 1 n, fib (3 * i) ^ 3 := by set g : ℕ → ZMod n := fun r => (fib r : ZMod n) ^ 3 with hg -- (A) one full period of cubes sums to zero have hA : ∑ r ∈ range T, g r = 0 := by obtain ⟨M, rfl⟩ : ∃ M, T = M + 2 := ⟨T - 2, by omega⟩ have hMe : Even M := by rcases hTe with ⟨u, hu⟩; exact ⟨u - 1, by omega⟩ have key := congrArg (Int.cast : ℤ → ZMod n) (sum_cubes M) push_cast at key have eA : (fib (3 * M + 5) : ZMod n) = 1 := by have := fib_add_mul_period h0 h1 (M + 1) 2 rw [show M + 1 + 2 * (M + 2) = 3 * M + 5 by ring] at this rw [this] have hs := fib_add_two (n := M) have : (fib (M + 1) : ZMod n) = fib (M + 2 + 1) - fib (M + 2) := by rw [show M + 2 + 1 = (M + 1) + 2 by ring, fib_add_two]; push_cast; ring rw [this, h0, h1]; ring have eB : (fib M : ZMod n) = -1 := by have e1 : (fib (M + 1) : ZMod n) = 1 := by have : (fib (M + 1) : ZMod n) = fib (M + 2 + 1) - fib (M + 2) := by rw [show M + 2 + 1 = (M + 1) + 2 by ring, fib_add_two]; push_cast; ring rw [this, h0, h1]; ring have : (fib M : ZMod n) = fib (M + 2) - fib (M + 1) := by rw [fib_add_two]; push_cast; ring rw [this, h0, e1]; ring rw [eA, eB, hMe.neg_one_pow] at key have h10 : (10 : ZMod n) * ∑ r ∈ range (M + 2), g r = 0 := by rw [hg]; simp only; rw [key]; ring have hu : IsUnit (10 : ZMod n) := by have := (ZMod.unitOfCoprime 10 hcop.symm).isUnit; simpa using this exact (hu.mul_right_eq_zero).1 h10 -- (B) multiplying the index by 3 permutes a period have hB : ∑ r ∈ range T, g (3 * r) = ∑ r ∈ range T, g r := by have hcop3 : Nat.Coprime 3 T := (Nat.Prime.coprime_iff_not_dvd Nat.prime_three).2 hT3 have hperm : ∀ r, g (3 * r) = g ((3 * r) % T) := fun r => by rw [hg]; simp only; rw [fib_mod_period h0 h1] rw [Finset.sum_congr rfl fun r _ => hperm r] refine Finset.sum_nbij (fun r => (3 * r) % T) (fun r _ => by simp; exact Nat.mod_lt _ (by omega)) ?_ ?_ (fun _ _ => rfl) · intro a ha b hb hab simp at ha hb have : 3 * a ≡ 3 * b [MOD T] := hab have := Nat.ModEq.cancel_left_of_coprime (Nat.coprime_comm.mp hcop3) this exact Nat.ModEq.eq_of_lt_of_lt this ha hb · have hinj : Set.InjOn (fun r => (3 * r) % T) (range T : Set ℕ) := by intro a ha b hb hab simp at ha hb have : 3 * a ≡ 3 * b [MOD T] := hab have := Nat.ModEq.cancel_left_of_coprime (Nat.coprime_comm.mp hcop3) this exact Nat.ModEq.eq_of_lt_of_lt this ha hb have hmaps : Set.MapsTo (fun r => (3 * r) % T) (range T : Set ℕ) (range T : Set ℕ) := fun r _ => by simp; exact Nat.mod_lt _ (by omega) have := (Finset.surj_on_of_inj_on_of_card_le (s := range T) (t := range T) (fun r _ => (3 * r) % T) (fun r hr => hmaps hr) (fun a b ha hb h => hinj ha hb h) le_rfl) intro b hb obtain ⟨a, ha, hab⟩ := this b hb exact ⟨a, ha, hab.symm⟩ -- (C) whole blocks have hC : ∀ t, ∑ i ∈ range (t * T), g (3 * i) = 0 := by intro t induction t with | zero => simp | succ t ih => rw [show (t + 1) * T = t * T + T by ring, Finset.sum_range_add, ih, zero_add] have : ∀ x, g (3 * (t * T + x)) = g (3 * x) := fun x => by rw [hg]; simp only rw [show 3 * (t * T + x) = 3 * x + (3 * t) * T by ring, fib_add_mul_period h0 h1] rw [Finset.sum_congr rfl fun x _ => this x, hB, hA] -- (D) assemble obtain ⟨t, ht⟩ := hTn have hD : ∑ i ∈ range (n + 1), g (3 * i) = 0 := by rw [ht, mul_comm]; exact hC t have hIcc : ∑ i ∈ Icc 1 n, g (3 * i) = ∑ i ∈ range (n + 1), g (3 * i) := by rw [Finset.sum_range_succ', ← Finset.Ico_add_one_right_eq_Icc, Finset.sum_Ico_eq_sum_range] simp [hg, add_comm] rw [← ZMod.natCast_eq_zero_iff] push_cast have := hIcc.trans hD simpa [hg] using this /-- **Application to Fibonacci numbers.** Let `m` be even with `3 ∤ m` and `2m ∣ F_m + 1`. Then `F_m` is odd and `F_m ∣ ∑_{i=1}^{F_m} F_{3i}^3`. -/ theorem fib_dvd_sum_cubes {m : ℕ} (hme : Even m) (hm3 : ¬ 3 ∣ m) (hdiv : 2 * m ∣ fib m + 1) : Odd (fib m) ∧ fib m ∣ ∑ i ∈ Icc 1 (fib m), fib (3 * i) ^ 3 := by have hm0 : m ≠ 0 := by rintro rfl; simp at hdiv -- `F_m` is coprime to `2` and to `5` have hcop2 : Nat.Coprime (fib m) 2 := by have h := fib_gcd m 3 have hg : Nat.gcd m 3 = 1 := (Nat.Coprime.symm ((Nat.Prime.coprime_iff_not_dvd Nat.prime_three).2 hm3)) rw [hg, fib_one, show fib 3 = 2 by rfl] at h exact h.symm have hm5 : ¬ 5 ∣ m := by intro h5 have : 5 ∣ fib m := by have := fib_dvd 5 m h5; rwa [show fib 5 = 5 by rfl] at this have h' : 5 ∣ fib m + 1 := dvd_trans (dvd_trans h5 (Dvd.intro_left 2 rfl)) hdiv omega have hcop5 : Nat.Coprime (fib m) 5 := by have h := fib_gcd m 5 have hg : Nat.gcd m 5 = 1 := (Nat.Coprime.symm ((Nat.Prime.coprime_iff_not_dvd Nat.prime_five).2 hm5)) rw [hg, fib_one, show fib 5 = 5 by rfl] at h exact h.symm have hcop : Nat.Coprime (fib m) 10 := by rw [show (10 : ℕ) = 2 * 5 by rfl]; exact Nat.Coprime.mul_right hcop2 hcop5 refine ⟨(Nat.coprime_two_right).1 hcop2, ?_⟩ -- Cassini for even `m`: `F_{m+1}^2 ≡ 1 (mod F_m)` obtain ⟨k, rfl⟩ : ∃ k, m = k + 1 := ⟨m - 1, by omega⟩ have hc := cassini k have hke : Odd k := by rcases hme with ⟨u, hu⟩; exact ⟨u - 1, by omega⟩ rw [hke.add_one.neg_one_pow] at hc refine dvd_sum_cubes (T := 2 * (k + 1)) hcop (by omega) (even_two_mul _) ?_ hdiv ?_ ?_ · omega · have := fib_dvd (k + 1) (2 * (k + 1)) (Dvd.intro_left 2 rfl) exact (ZMod.natCast_eq_zero_iff _ _).2 this · -- `F_{2(k+1)+1} = F_{k+2}^2 + F_{k+1}^2 ≡ F_{k+2}^2 ≡ F_{k+2} F_k ≡ 1` have h2 := fib_two_mul_add_one (k + 1) rw [show 2 * (k + 1) + 1 = 2 * (k + 1) + 1 by rfl] at h2 have hz : ((fib (k + 1) : ℤ) : ZMod (fib (k + 1))) = 0 := by simp have e2 : (fib (k + 2) : ℤ) = fib k + fib (k + 1) := by rw [fib_add_two]; push_cast; ring have hcZ := congrArg (Int.cast : ℤ → ZMod (fib (k + 1))) hc push_cast at hcZ have hz' : (fib (k + 1) : ZMod (fib (k + 1))) = 0 := by simp rw [h2]; push_cast rw [show k + 1 + 1 = k + 2 by ring, hz'] rw [hz'] at hcZ have e2' : (fib (k + 2) : ZMod (fib (k + 1))) = fib k := by rw [fib_add_two]; push_cast; rw [hz']; ring rw [e2'] at hcZ ⊢ linear_combination hcZ /-- Instances: `F_34` and `F_46` are odd and divide their cube sums. These are the cases `p = 17` and `p = 23` of the family `F_{2p}`, `p ≡ 17, 23 (mod 30)`. -/ example : Odd (fib 34) ∧ fib 34 ∣ ∑ i ∈ Icc 1 (fib 34), fib (3 * i) ^ 3 := fib_dvd_sum_cubes ⟨17, rfl⟩ (by norm_num) (by norm_num [Nat.fib_add_two]) /-! ## Flynn-Connolly's congruence and the infinite family -/ section FlynnConnolly open Polynomial variable {p : ℕ} [hp : Fact p.Prime] theorem not_isSquare_two_zmod5 : ¬ IsSquare ((2 : ℕ) : ZMod 5) := by decide theorem not_isSquare_three_zmod5 : ¬ IsSquare ((3 : ℕ) : ZMod 5) := by decide /-- For a prime `p ≡ ±2 (mod 5)`, `p ≠ 2`, we have `(5/p) = -1`. -/ theorem legendre_five (h5 : p % 5 = 2 ∨ p % 5 = 3) (hp2 : p ≠ 2) : legendreSym p 5 = -1 := by have : Fact (Nat.Prime 5) := ⟨by norm_num⟩ have qr := legendreSym.quadratic_reciprocity_one_mod_four (p := 5) (q := p) (by norm_num) hp2 have qr' : legendreSym p 5 = legendreSym 5 p := by exact_mod_cast qr rw [qr', legendreSym.eq_neg_one_iff] have hc : ((p : ℤ) : ZMod 5) = ((p % 5 : ℕ) : ZMod 5) := by rw [Int.cast_natCast, ZMod.natCast_mod] rcases h5 with h | h <;> rw [hc, h] · exact not_isSquare_two_zmod5 · exact not_isSquare_three_zmod5 /-- The quadratic ring `𝔽_p[√5]`. -/ noncomputable abbrev f5 (p : ℕ) : (ZMod p)[X] := X ^ 2 - C 5 theorem deg_f5 : (f5 p).degree = 2 := by rw [f5, degree_X_pow_sub_C (by norm_num)]; rfl /-- `F_{2p} ≡ -1 (mod p)` for primes `p ≡ ±2 (mod 5)`, `p ≠ 2`. -/ theorem fib_two_mul_mod_p (h5 : p % 5 = 2 ∨ p % 5 = 3) (hp2 : p ≠ 2) : ((fib (2 * p) : ZMod p) + 1) = 0 := by set R := AdjoinRoot (f5 p) set ι := AdjoinRoot.of (f5 p) set s : R := AdjoinRoot.root (f5 p) have hinj : Function.Injective ι := AdjoinRoot.of.injective_of_degree_ne_zero (by rw [deg_f5]; norm_num) have : CharP R p := charP_of_injective_algebraMap (R := ZMod p) (A := R) hinj p have s_sq : s ^ 2 = 5 := by have h := AdjoinRoot.eval₂_root (f5 p) simp [f5, sub_eq_zero] at h rw [show (AdjoinRoot.of (X ^ 2 - C 5 : (ZMod p)[X])) 5 = 5 from map_ofNat _ 5] at h exact h -- coefficient extraction have coeff0 : ∀ c d : ZMod p, ι c * s + ι d = 0 → c = 0 := by intro c d h have hm : AdjoinRoot.mk (f5 p) (C c * X + C d) = 0 := by simpa [AdjoinRoot.mk_C, AdjoinRoot.mk_X, ι, s] using h rw [AdjoinRoot.mk_eq_zero] at hm have hlt : (C c * X + C d).degree < (f5 p).degree := by rw [deg_f5]; exact lt_of_le_of_lt degree_linear_le (by norm_num) have h0 := Polynomial.eq_zero_of_dvd_of_degree_lt hm hlt have := congrArg (fun q => coeff q 1) h0 simpa using this have h2 : (2 : ZMod p) ≠ 0 := by intro h have : (p : ℕ) ∣ 2 := by exact_mod_cast (ZMod.natCast_eq_zero_iff 2 p).1 (by exact_mod_cast h) have := (Nat.prime_dvd_prime_iff_eq hp.out Nat.prime_two).1 this exact hp2 this set h : R := ι (2 : ZMod p)⁻¹ have two_inv : 2 * h = 1 := by rw [show (2 : R) = ι 2 from (map_ofNat ι 2).symm, ← map_mul, mul_inv_cancel₀ h2, map_one] -- `s^p = -s` have hodd : p % 2 = 1 := (Nat.Prime.mod_two_eq_one_iff_ne_two hp.out).2 hp2 have s_pow : s ^ p = -s := by have hl := legendreSym.eq_pow (p := p) 5 rw [legendre_five h5 hp2] at hl have : s ^ p = s ^ (2 * (p / 2)) * s := by rw [← pow_succ]; congr 1; omega rw [this, pow_mul, s_sq] have h5' : (5 : R) ^ (p / 2) = ι ((5 : ZMod p) ^ (p / 2)) := by rw [map_pow, map_ofNat] rw [h5', show ((5 : ZMod p) ^ (p / 2)) = (((5 : ℤ) : ZMod p) ^ (p / 2)) by norm_num, ← hl] simp [ι, neg_one_mul] set w : R := h * (1 + s) have w_sq : w ^ 2 = w + 1 := by simp only [w]; linear_combination h ^ 2 * s_sq + (h * (3 + s) + 1) * two_inv have w_pow : ∀ n : ℕ, w ^ (n + 1) = (fib (n + 1) : R) * w + fib n := by intro n induction n with | zero => simp | succ n ih => rw [pow_succ, ih, fib_add_two]; push_cast linear_combination (fib (n + 1) : R) * w_sq have hfrob : w ^ p = 1 - w := by have hh : h ^ p = h := by simp only [h, ← map_pow, ZMod.pow_card] have : w ^ p = h ^ p * (1 + s ^ p) := by simp only [w]; rw [mul_pow, add_pow_char, one_pow] rw [this, hh, s_pow]; simp only [w]; linear_combination two_inv have h2p : w ^ (2 * p) = 2 - w := by rw [mul_comm, pow_mul, hfrob]; linear_combination w_sq obtain ⟨k, hk⟩ : ∃ k, 2 * p = k + 1 := ⟨2 * p - 1, by have := hp.out.two_le; omega⟩ have e := w_pow k rw [← hk, h2p] at e -- `(F_{2p} + 1) w + (F_k - 2) = 0` have key : ι (((fib (2 * p) : ZMod p) + 1) * (2 : ZMod p)⁻¹) * s + ι (((fib (2 * p) : ZMod p) + 1) * (2 : ZMod p)⁻¹ + fib k - 2) = 0 := by simp only [map_mul, map_add, map_sub, map_natCast, map_one, map_ofNat] simp only [w] at e linear_combination -e have := coeff0 _ _ key rcases mul_eq_zero.1 this with h' | h' · exact h' · exact absurd h' (inv_ne_zero h2) end FlynnConnolly /-- `F_{2p} ≡ 3 (mod 4)` when `p ≡ 2 (mod 3)`. -/ theorem fib_two_mul_mod_four {p : ℕ} (hp3 : p % 3 = 2) : 4 ∣ fib (2 * p) + 1 := by have h0 : (fib 6 : ZMod 4) = 0 := by decide have h1 : (fib (6 + 1) : ZMod 4) = 1 := by decide have := fib_mod_period h0 h1 (2 * p) rw [show (2 * p) % 6 = 4 by omega] at this rw [← ZMod.natCast_eq_zero_iff]; push_cast; rw [this]; decide /-- **Flynn-Connolly's congruence.** For a prime `p ≡ 17` or `23 (mod 30)`, `4p ∣ F_{2p} + 1`. -/ theorem four_mul_dvd_fib_two_mul_add_one {p : ℕ} (hp : p.Prime) (h : p % 30 = 17 ∨ p % 30 = 23) : 4 * p ∣ fib (2 * p) + 1 := by have := Fact.mk hp have hp2 : p ≠ 2 := by rintro rfl; omega have hmodp : p ∣ fib (2 * p) + 1 := by have := fib_two_mul_mod_p (p := p) (by omega) hp2 rw [← ZMod.natCast_eq_zero_iff]; push_cast; exact this have hcop : Nat.Coprime 4 p := by rw [show (4 : ℕ) = 2 ^ 2 by rfl] exact Nat.Coprime.pow_left 2 ((Nat.coprime_primes Nat.prime_two hp).2 (Ne.symm hp2)) exact hcop.mul_dvd_of_dvd_of_dvd (fib_two_mul_mod_four (by omega)) hmodp /-- **Answer to Remark 1.13 of Mandal–Mohan.** There are infinitely many odd `n` with `n ∣ ∑_{i=1}^n F_{3i}^3`. Namely `n = F_{2p}` for every prime `p ≡ 17 (mod 30)`. -/ theorem infinite_odd_dvd_sum_cubes : {n : ℕ | Odd n ∧ n ∣ ∑ i ∈ Icc 1 n, fib (3 * i) ^ 3}.Infinite := by apply Set.infinite_of_forall_exists_gt intro N have hu : IsUnit (17 : ZMod 30) := by decide obtain ⟨p, hpN, hp, hpmod⟩ := Nat.forall_exists_prime_gt_and_eq_mod hu (N + 8) have h30 : p % 30 = 17 := by have := congrArg ZMod.val hpmod rwa [ZMod.val_natCast] at this have hdiv := four_mul_dvd_fib_two_mul_add_one hp (Or.inl h30) have hres := fib_dvd_sum_cubes (m := 2 * p) (even_two_mul p) (by omega) (by rw [show 2 * (2 * p) = 4 * p by ring]; exact hdiv) refine ⟨fib (2 * p), hres, ?_⟩ obtain ⟨j, hj⟩ : ∃ j, 2 * p = j + 8 := ⟨2 * p - 8, by omega⟩ have := (FibHarmonic.two_mul_le_fib j).1 rw [hj]; omega end FibCubes