/- 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 FormalConjecturesUtil

Erdős Problem 318

References:

    erdosproblems.com/318

    [ErSt75] Erdős, P. and Straus, E. G., Solution to Problem 387. Nieuw Arch. Wisk. (1975), 183.

    [Sa75] Sattler, R., Solution to Problem 387. Nieuw Arch. Wisk. (1975), 184-189.

    [Sa82b] Sattler, R., On Erdős property P₁ for the arithmetical sequence. Nederl. Akad. Wetensch. Indag. Math. (1982), 347--352.

    [ErGr80] Erdős, P. and Graham, R., Old and new problems and results in combinatorial number theory. Monographies de L'Enseignement Mathematique (1980).

    [La26] D. Larsen, Erdős problem 318 (2026)

open Set Real namespace Erdos318

A set A : Set ℕ is said to have propery P₁ if for any nonconstant sequence f : A → {-1, 1}, one can always select a finite, nonempty subset S ⊆ A \ {0} such that ∑ n ∈ S, fₙ / n = 0. This is defined in [Sa82b].

def P₁ (A : Set ) : Prop := (f : ), f (Subtype.val : (A \ {0} : Set ) ) (fun _ => 1) f (Subtype.val : (A \ {0} : Set ) ) (fun _ => - 1) Set.range f {1, -1} S : Finset , S.Nonempty S A \ {0} n S, f n / n = 0

has property P₁. This is proved in [ErSt75].

@[category research solved, AMS 11] theorem declaration uses 'sorry'erdos_318.variants.univ : P₁ univ := P₁ Set.univ All goals completed! 🐙

Sattler proved in [Sa75] that the set of odd numbers has property P₁.

@[category research solved, AMS 11] theorem declaration uses 'sorry'erdos_318.variants.odd : P₁ {n | Odd n} := P₁ {n | Odd n} All goals completed! 🐙

The set of squares does not have property P₁.

@[category test, AMS 11] theorem erdos_318.variants.squares : ¬ P₁ ({n | IsSquare n}) := ¬P₁ {n | IsSquare n} x, (_ : x Subtype.val fun x => 1) (_ : x Subtype.val fun x => -1) (_ : range x {1, -1}), (x_1 : Finset ), x_1.Nonempty x_1 {n | IsSquare n} \ {0} ¬ n x_1, x n / n = 0 -- Consider the function `f` that sends `1` to `1` and sends all other numbers to `-1`. h:(fun n => if n = 1 then 1 else -1) Subtype.val = fun x => 1Falseh:(fun n => if n = 1 then 1 else -1) Subtype.val = fun x => -1Falsex:x✝:x range fun n => if n = 1 then 1 else -1y:hy:(fun n => if n = 1 then 1 else -1) y = xx {1, -1}S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}¬ n S, (fun n => if n = 1 then 1 else -1) n / n = 0 h:(fun n => if n = 1 then 1 else -1) Subtype.val = fun x => 1False have : (- 1 : ) = 1 := ¬P₁ {n | IsSquare n} simpa using congr_fun h 4, 2, h:(fun n => if n = 1 then 1 else -1) Subtype.val = fun x => 14 = 2 * 2 All goals completed! 🐙, h:(fun n => if n = 1 then 1 else -1) Subtype.val = fun x => 14 {0} All goals completed! 🐙 All goals completed! 🐙 h:(fun n => if n = 1 then 1 else -1) Subtype.val = fun x => -1False have : 1 = (- 1 : ) := ¬P₁ {n | IsSquare n} simpa using congr_fun h 1, IsSquare.one, h:(fun n => if n = 1 then 1 else -1) Subtype.val = fun x => -11 {0} All goals completed! 🐙 All goals completed! 🐙 x:x✝:x range fun n => if n = 1 then 1 else -1y:hy:(fun n => if n = 1 then 1 else -1) y = xx {1, -1} x:x✝:x range fun n => if n = 1 then 1 else -1y:hy:(fun n => if n = 1 then 1 else -1) y = xh✝:x = 1x {1, -1}x:x✝:x range fun n => if n = 1 then 1 else -1y:hy:(fun n => if n = 1 then 1 else -1) y = xh✝:¬x = 1x {1, -1} x:x✝:x range fun n => if n = 1 then 1 else -1y:hy:(fun n => if n = 1 then 1 else -1) y = xh✝:x = 1x {1, -1}x:x✝:x range fun n => if n = 1 then 1 else -1y:hy:(fun n => if n = 1 then 1 else -1) y = xh✝:¬x = 1x {1, -1} All goals completed! 🐙 -- Consider two cases: `1 ∈ S` or `1 ∉ S`. In the first case, the finite sum over `S` is bounded -- below by `1 - (π ^ 2 / 6 - 1)`, which is positive. In the second case, the finite sum over `S` -- is negative. S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S¬ n S, (fun n => if n = 1 then 1 else -1) n / n = 0S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S¬ n S, (fun n => if n = 1 then 1 else -1) n / n = 0 S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S¬ n S, (fun n => if n = 1 then 1 else -1) n / n = 0 S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S¬(fun n => if n = 1 then 1 else -1) 1 / 1 + n S \ {1}, -1 / n = 0S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S x S \ {1}, (fun n => if n = 1 then 1 else -1) x / x = -1 / x S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S¬(fun n => if n = 1 then 1 else -1) 1 / 1 + n S \ {1}, -1 / n = 0 S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S1 - x S \ {1}, 1 / x 0 S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S0 < 1 - x S \ {1}, 1 / x calc _ < 1 - (π ^ 2 / 6 - 1) := S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S0 < 1 - (π ^ 2 / 6 - 1) have : π ^ 2 < 3.15 ^ 2 := S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S0 < 1 - (π ^ 2 / 6 - 1) S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sπ < 3.15; All goals completed! 🐙 All goals completed! 🐙 _ = 1 - (∑' n : , 1 / (n : ) ^ 2 - 1) := S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S1 - (π ^ 2 / 6 - 1) = 1 - (∑' (n : ), 1 / n ^ 2 - 1) S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sπ ^ 2 / 6 = ∑' (n : ), 1 / n ^ 2; All goals completed! 🐙 _ 1 - n S \ {1}, 1 / (n : ) := S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S1 - (∑' (n : ), 1 / n ^ 2 - 1) 1 - n S \ {1}, 1 / n S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S n S \ {1}, 1 / n ∑' (n : ), 1 / n ^ 2 - 1 have : 1 = 1 / ((1 : ) : ) := S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S1 - (∑' (n : ), 1 / n ^ 2 - 1) 1 - n S \ {1}, 1 / n S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S1 = 1 / 1; All goals completed! 🐙 S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sthis:1 = 1 / 1 := Eq.mpr (id (Eq.trans (congr (congrArg Eq (Eq.symm Nat.cast_one)) (congrArg (fun x => x / 1) (Eq.symm Nat.cast_one))) (congr (congrArg Eq Nat.cast_one) (congr (congrArg HDiv.hDiv Nat.cast_one) Nat.cast_one)))) squares._proof_12 n S \ {1}, 1 / n ∑' (n : ), 1 / n ^ 2 - 1 / 1 S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sthis:1 = 1 / 1 := Eq.mpr (id (Eq.trans (congr (congrArg Eq (Eq.symm Nat.cast_one)) (congrArg (fun x => x / 1) (Eq.symm Nat.cast_one))) (congr (congrArg Eq Nat.cast_one) (congr (congrArg HDiv.hDiv Nat.cast_one) Nat.cast_one)))) squares._proof_12 x S, 1 / x ∑' (n : ), 1 / n ^ 2 let S' := S.preimage (· ^ 2) (Function.Injective.injOn (Nat.pow_left_injective (S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sthis:1 = 1 / 1 := Eq.mpr (id (Eq.trans (congr (congrArg Eq (Eq.symm Nat.cast_one)) (congrArg (fun x => x / 1) (Eq.symm Nat.cast_one))) (congr (congrArg Eq Nat.cast_one) (congr (congrArg HDiv.hDiv Nat.cast_one) Nat.cast_one)))) squares._proof_122 0 All goals completed! 🐙))) have hS' : S'.map (· ^ 2), Nat.pow_left_injective (S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sthis:1 = 1 / 1 := Eq.mpr (id (Eq.trans (congr (congrArg Eq (Eq.symm Nat.cast_one)) (congrArg (fun x => x / 1) (Eq.symm Nat.cast_one))) (congr (congrArg Eq Nat.cast_one) (congr (congrArg HDiv.hDiv Nat.cast_one) Nat.cast_one)))) squares._proof_12S':Finset := S.preimage (fun x => x ^ 2) 2 0 All goals completed! 🐙) = S := S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S1 - (∑' (n : ), 1 / n ^ 2 - 1) 1 - n S \ {1}, 1 / n S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sthis:1 = 1 / 1 := Eq.mpr (id (Eq.trans (congr (congrArg Eq (Eq.symm Nat.cast_one)) (congrArg (fun x => x / 1) (Eq.symm Nat.cast_one))) (congr (congrArg Eq Nat.cast_one) (congr (congrArg HDiv.hDiv Nat.cast_one) Nat.cast_one)))) squares._proof_12S':Finset := S.preimage (fun x => x ^ 2) (Finset.map { toFun := fun x => x ^ 2, inj' := } S') = S have h : (S : Set ) Set.range (· ^ 2) := hs.trans (S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sthis:1 = 1 / 1 := Eq.mpr (id (Eq.trans (congr (congrArg Eq (Eq.symm Nat.cast_one)) (congrArg (fun x => x / 1) (Eq.symm Nat.cast_one))) (congr (congrArg Eq Nat.cast_one) (congr (congrArg HDiv.hDiv Nat.cast_one) Nat.cast_one)))) squares._proof_12S':Finset := S.preimage (fun x => x ^ 2) {n | IsSquare n} \ {0} range fun x => x ^ 2 All goals completed! 🐙) All goals completed! 🐙 S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sthis:1 = 1 / 1 := Eq.mpr (id (Eq.trans (congr (congrArg Eq (Eq.symm Nat.cast_one)) (congrArg (fun x => x / 1) (Eq.symm Nat.cast_one))) (congr (congrArg Eq Nat.cast_one) (congr (congrArg HDiv.hDiv Nat.cast_one) Nat.cast_one)))) squares._proof_12S':Finset := S.preimage (fun x => x ^ 2) hS':Finset.map { toFun := fun x => x ^ 2, inj' := } S' = S := Finset.coe_injective (have h := HasSubset.Subset.trans hs (of_eq_true (Eq.trans (congrArg (fun x => setOf x \ {0} range fun x => x ^ 2) (funext fun n => squares._simp_13 n)) (Eq.trans (Eq.trans (forall_congr fun x => Eq.trans (Eq.trans (implies_congr (Eq.trans (mem_diff._simp_1 x) (congrArg (fun x_1 => (∃ r, x = r ^ 2) ¬x_1) mem_singleton_iff._simp_1)) mem_range._simp_1) and_imp._simp_1) forall_exists_index._simp_1) forall_eq_apply_imp_iff._simp_1) (Eq.trans (forall_congr fun a => Eq.trans (implies_congr (congrArg Not (Eq.trans Nat.pow_eq_zero._simp_1 (Eq.trans (congrArg (And (a = 0)) (Eq.trans (congrArg Not (OfNat.ofNat_ne_zero._simp_1 2)) not_false_eq_true)) (and_true (a = 0))))) (Eq.trans (congrArg Exists (funext fun y => pow_left_inj₀._simp_1 (of_eq_true (one_le._simp_2 y)) (of_eq_true (one_le._simp_2 a)) (of_eq_true (Eq.trans (congrArg Not (OfNat.ofNat_ne_zero._simp_1 2)) not_false_eq_true)))) exists_eq._simp_1)) (implies_true ¬a = 0)) (implies_true ))))); Eq.mpr (id (Eq.trans (congrArg (fun x => x = S) (Eq.trans (Finset.coe_map { toFun := fun x => x ^ 2, inj' := Nat.pow_left_injective (of_decide_eq_true (id (Eq.refl true))) } (S.preimage (fun x => x ^ 2) (Function.Injective.injOn (Nat.pow_left_injective (of_decide_eq_true (id (Eq.refl true))))))) (Eq.trans (image_congr fun a a_1 => Eq.refl (a ^ 2)) (congrArg (image fun x => x ^ 2) (Finset.coe_preimage S (Function.Injective.injOn (Nat.pow_left_injective (of_decide_eq_true (id (Eq.refl true)))))))))) squares._simp_14)) h) x S', 1 / (x ^ 2) ∑' (n : ), 1 / n ^ 2 simpa [Nat.cast_pow] using Summable.sum_le_tsum S' (fun _ _ => S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sthis:1 = 1 / 1 := Eq.mpr (id (Eq.trans (congr (congrArg Eq (Eq.symm Nat.cast_one)) (congrArg (fun x => x / 1) (Eq.symm Nat.cast_one))) (congr (congrArg Eq Nat.cast_one) (congr (congrArg HDiv.hDiv Nat.cast_one) Nat.cast_one)))) squares._proof_12S':Finset := S.preimage (fun x => x ^ 2) hS':Finset.map { toFun := fun x => x ^ 2, inj' := } S' = S := Finset.coe_injective (have h := HasSubset.Subset.trans hs (of_eq_true (Eq.trans (congrArg (fun x => setOf x \ {0} range fun x => x ^ 2) (funext fun n => squares._simp_13 n)) (Eq.trans (Eq.trans (forall_congr fun x => Eq.trans (Eq.trans (implies_congr (Eq.trans (mem_diff._simp_1 x) (congrArg (fun x_1 => (∃ r, x = r ^ 2) ¬x_1) mem_singleton_iff._simp_1)) mem_range._simp_1) and_imp._simp_1) forall_exists_index._simp_1) forall_eq_apply_imp_iff._simp_1) (Eq.trans (forall_congr fun a => Eq.trans (implies_congr (congrArg Not (Eq.trans Nat.pow_eq_zero._simp_1 (Eq.trans (congrArg (And (a = 0)) (Eq.trans (congrArg Not (OfNat.ofNat_ne_zero._simp_1 2)) not_false_eq_true)) (and_true (a = 0))))) (Eq.trans (congrArg Exists (funext fun y => pow_left_inj₀._simp_1 (of_eq_true (one_le._simp_2 y)) (of_eq_true (one_le._simp_2 a)) (of_eq_true (Eq.trans (congrArg Not (OfNat.ofNat_ne_zero._simp_1 2)) not_false_eq_true)))) exists_eq._simp_1)) (implies_true ¬a = 0)) (implies_true ))))); Eq.mpr (id (Eq.trans (congrArg (fun x => x = S) (Eq.trans (Finset.coe_map { toFun := fun x => x ^ 2, inj' := Nat.pow_left_injective (of_decide_eq_true (id (Eq.refl true))) } (S.preimage (fun x => x ^ 2) (Function.Injective.injOn (Nat.pow_left_injective (of_decide_eq_true (id (Eq.refl true))))))) (Eq.trans (image_congr fun a a_1 => Eq.refl (a ^ 2)) (congrArg (image fun x => x ^ 2) (Finset.coe_preimage S (Function.Injective.injOn (Nat.pow_left_injective (of_decide_eq_true (id (Eq.refl true)))))))))) squares._simp_14)) h)x✝¹:x✝:x✝¹ S'0 (x✝¹ ^ 2)⁻¹ All goals completed! 🐙) (S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sthis:1 = 1 / 1 := Eq.mpr (id (Eq.trans (congr (congrArg Eq (Eq.symm Nat.cast_one)) (congrArg (fun x => x / 1) (Eq.symm Nat.cast_one))) (congr (congrArg Eq Nat.cast_one) (congr (congrArg HDiv.hDiv Nat.cast_one) Nat.cast_one)))) squares._proof_12S':Finset := S.preimage (fun x => x ^ 2) hS':Finset.map { toFun := fun x => x ^ 2, inj' := } S' = S := Finset.coe_injective (have h := HasSubset.Subset.trans hs (of_eq_true (Eq.trans (congrArg (fun x => setOf x \ {0} range fun x => x ^ 2) (funext fun n => squares._simp_13 n)) (Eq.trans (Eq.trans (forall_congr fun x => Eq.trans (Eq.trans (implies_congr (Eq.trans (mem_diff._simp_1 x) (congrArg (fun x_1 => (∃ r, x = r ^ 2) ¬x_1) mem_singleton_iff._simp_1)) mem_range._simp_1) and_imp._simp_1) forall_exists_index._simp_1) forall_eq_apply_imp_iff._simp_1) (Eq.trans (forall_congr fun a => Eq.trans (implies_congr (congrArg Not (Eq.trans Nat.pow_eq_zero._simp_1 (Eq.trans (congrArg (And (a = 0)) (Eq.trans (congrArg Not (OfNat.ofNat_ne_zero._simp_1 2)) not_false_eq_true)) (and_true (a = 0))))) (Eq.trans (congrArg Exists (funext fun y => pow_left_inj₀._simp_1 (of_eq_true (one_le._simp_2 y)) (of_eq_true (one_le._simp_2 a)) (of_eq_true (Eq.trans (congrArg Not (OfNat.ofNat_ne_zero._simp_1 2)) not_false_eq_true)))) exists_eq._simp_1)) (implies_true ¬a = 0)) (implies_true ))))); Eq.mpr (id (Eq.trans (congrArg (fun x => x = S) (Eq.trans (Finset.coe_map { toFun := fun x => x ^ 2, inj' := Nat.pow_left_injective (of_decide_eq_true (id (Eq.refl true))) } (S.preimage (fun x => x ^ 2) (Function.Injective.injOn (Nat.pow_left_injective (of_decide_eq_true (id (Eq.refl true))))))) (Eq.trans (image_congr fun a a_1 => Eq.refl (a ^ 2)) (congrArg (image fun x => x ^ 2) (Finset.coe_preimage S (Function.Injective.injOn (Nat.pow_left_injective (of_decide_eq_true (id (Eq.refl true)))))))))) squares._simp_14)) h)Summable fun x => (x ^ 2)⁻¹ All goals completed! 🐙) S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S x S \ {1}, (fun n => if n = 1 then 1 else -1) x / x = -1 / x intro _ S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sx✝:a✝:x✝ S \ {1}(fun n => if n = 1 then 1 else -1) x✝ / x✝ = -1 / x✝; All goals completed! 🐙 S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 S¬ n S, (fun n => if n = 1 then 1 else -1) n / n = 0 suffices n S, (fun n if n = 1 then 1 else - 1) n / (n : ) < 0 from S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sthis: n S, (fun n => if n = 1 then 1 else -1) n / n < 0 := ?m.627¬ n S, (fun n => if n = 1 then 1 else -1) n / n = 0 All goals completed! 🐙 S:Finset h:S.Nonemptyhs:S {n | IsSquare n} \ {0}h1:1 Sp:hp:p S(fun n => if n = 1 then 1 else -1) p / p < 0 have : p 1 := ¬P₁ {n | IsSquare n} All goals completed! 🐙 All goals completed! 🐙

For any set A containing exactly one even number, A does not have property P₁. Sattler [Sa82] credits this observation to Erdős, who presumably found this after [ErGr80].

@[category research solved, AMS 11] theorem declaration uses 'sorry'erdos_318.variants.contain_single_even {A : Set } (hA : {n | n A Even n}.ncard = 1) : ¬ P₁ A := A:Set hA:{n | n A Even n}.ncard = 1¬P₁ A All goals completed! 🐙

There exists a set A with positive density that does not have property P₁. #TODO: prove this lemma by assuming erdos_318.contain_single_even.

@[category research solved, AMS 11] theorem declaration uses 'sorry'erdos_318.parts.i : A : Set , HasPosDensity A ¬ P₁ A := A, A.HasPosDensity ¬P₁ A All goals completed! 🐙

Every infinite arithmetic progression has property P₁. This is proved in [Sa82b].

@[category research solved, AMS 11] theorem declaration uses 'sorry'erdos_318.variants.infinite_AP {A : Set } (hA : A.IsAPOfLength ) : P₁ A := A:Set hA:A.IsAPOfLength P₁ A All goals completed! 🐙

Does the set of squares excluding 1 have property P₁?

Larsen [La26] proved that this set does have property P₁.

@[category research solved, AMS 11] theorem declaration uses 'sorry'erdos_318.parts.ii : answer(True) P₁ ({n | IsSquare n} \ {1}) := True P₁ ({n | IsSquare n} \ {1}) All goals completed! 🐙 end Erdos318