ChristianZ97/putnambench-satp-v4.27 huggingface dataset:
Problem: putnam_2017_b3
Category: number_theory

Suppose that $f(x) = \sum_{i=0}^\infty c_i x^i$ is a power series for which each coefficient $c_i$ is $0$ or $1$. Show that if $f(2/3) = 3/2$, then $f(1/2)$ must be irrational.


Lean 4 formalization:
import Mathlib

open Topology Filter

theorem putnam_2017_b3
(f : ℝ → ℝ)
(c : ℕ → ℝ)
(hc : ∀ n, c n = 0 ∨ c n = 1)
(hf : ∀ x, f x = ∑' n : ℕ, (c n) * x^n)
: f (2/3) = 3/2 → Irrational (f 1/2) := by
Problem: putnam_2017_b4
Category: algebra

Evaluate the sum \begin{gather*} \sum_{k=0}^\infty \left( 3 \cdot \frac{\ln(4k+2)}{4k+2} - \frac{\ln(4k+3)}{4k+3} - \frac{\ln(4k+4)}{4k+4} - \frac{\ln(4k+5)}{4k+5} \right) \ = 3 \cdot \frac{\ln 2}{2} - \frac{\ln 3}{3} - \frac{\ln 4}{4} - \frac{\ln 5}{5} + 3 \cdot \frac{\ln 6}{6} - \frac{\ln 7}{7} \ - \frac{\ln 8}{8} - \frac{\ln 9}{9} + 3 \cdot \frac{\ln 10}{10} - \cdots . \end{gather*} (As usual, $\ln x$ denotes the natural logarithm of $x$.)

Solution: Prove that the sum equals $(\ln 2)^2$.

Lean 4 formalization:
import Mathlib

open Topology Filter Real

noncomputable abbrev putnam_2017_b4_solution : ℝ := sorry
theorem putnam_2017_b4 :
  (∑' k : ℕ, (3 * log (4 * k + 2) / (4 * k + 2) - log (4 * k + 3) / (4 * k + 3) - log (4 * k + 4) / (4 * k + 4) - log (4 * k + 5) / (4 * k + 5)) = putnam_2017_b4_solution) := by
Problem: putnam_2017_b6
Category: algebra, number_theory

Find the number of ordered $64$-tuples $(x_0,x_1,\dots,x_{63})$ such that $x_0,x_1,\dots,x_{63}$ are distinct elements of $\{1,2,\dots,2017\}$ and
\[
x_0 + x_1 + 2x_2 + 3x_3 + \cdots + 63 x_{63}
\]
is divisible by 2017.

Solution: Prove that the answer is $\frac{2016!}{1953!} - 63! \cdot 2016$

Lean 4 formalization:
import Mathlib

open Topology Filter Real Function Nat

abbrev putnam_2017_b6_solution : ℕ := sorry
theorem putnam_2017_b6
  (S : Finset (Finset.range 64 → Finset.Icc 1 2017))
  (hs : ∀ x, x ∈ S ↔ (Injective x ∧ (2017 ∣ (∑ i : Finset.range 64, if i ≤ (⟨1, by norm_num⟩ : Finset.range 64) then (x i : ℤ) else i * (x i : ℤ))))) :
  S.card = putnam_2017_b6_solution := by
Problem: putnam_2018_a1
Category: number_theory

Find all ordered pairs $(a,b)$ of positive integers for which $\frac{1}{a} + \frac{1}{b} = \frac{3}{2018}$.

Solution: Show that all solutions are in the set of ${(673,1358114), (674,340033), (1009,2018), (2018,1009), (340033,674), (1358114,673)}$.

Lean 4 formalization:
import Mathlib

abbrev putnam_2018_a1_solution : Set (ℤ × ℤ) := sorry
theorem putnam_2018_a1
  (a b : ℤ)
  (h : 0 < a ∧ 0 < b) :
  ((1 : ℚ) / a + (1 : ℚ) / b = (3 : ℚ) / 2018) ↔ (⟨a, b⟩ ∈ putnam_2018_a1_solution) := by
Problem: putnam_2018_a2
Category: linear_algebra

Let \( S_1, S_2, \ldots, S_{2^n-1} \) be the nonempty subsets of \( \{1, 2, \ldots, n\} \) in some order, and let \( M \) be the \( (2^n - 1) \times (2^n - 1) \) matrix whose \((i, j)\) entry is $m_{ij} = \begin{cases} 0 & \text{if } S_i \cap S_j = \emptyset; \\ 1 & \text{otherwise}. \end{cases} $ Calculate the determinant of \( M \).

Solution: Show that the solution is 1 if n = 1, and otherwise -1.

Lean 4 formalization:
import Mathlib

abbrev putnam_2018_a2_solution : ℕ → ℝ := sorry
theorem putnam_2018_a2
(n : ℕ)
(S : Fin (2 ^ n - 1) → Set ℕ)
(M : Matrix (Fin (2 ^ n - 1)) (Fin (2 ^ n - 1)) ℝ)
(npos : n ≥ 1)
(hS : Set.range S = (Set.Icc 1 n).powerset \ {∅})
(hM : ∀ i j, M i j = if (S i ∩ S j = ∅) = True then 0 else 1) :
M.det = putnam_2018_a2_solution n := by
Problem: putnam_2018_a3
Category: number_theory

Determine the greatest possible value of $\sum_{i=1}^{10} \cos(3x_i)$ for real numbers $x_1, x_2, \ldots, x_{10}$ satisfying $\sum_{i=1}^{10} \cos(x_i) = 0$.

Solution: Show that the solution is $\frac{480}{49}$

Lean 4 formalization:
import Mathlib

noncomputable abbrev putnam_2018_a3_solution : ℝ := sorry
theorem putnam_2018_a3 :
    IsGreatest
      {∑ i, Real.cos (3 * x i) | (x : Fin 10 → ℝ) (hx : ∑ i, Real.cos (x i) = 0)}
      putnam_2018_a3_solution := by
Problem: putnam_2018_a4
Category: abstract_algebra, number_theory

Let $m$ and $n$ be positive integers with $\gcd(m,n)=1$, and let $a_k=\left\lfloor \frac{mk}{n} \right\rfloor - \left\lfloor \frac{m(k-1)}{n} \right\rfloor$ for $k=1,2,\dots,n$. Suppose that $g$ and $h$ are elements in a group $G$ and that $gh^{a_1}gh^{a_2} \cdots gh^{a_n}=e$, where $e$ is the identity element. Show that $gh=hg$. (As usual, $\lfloor x \rfloor$ denotes the greatest integer less than or equal to $x$.)


Lean 4 formalization:
import Mathlib

theorem putnam_2018_a4
(m n : ℕ)
(a : ℕ → ℤ)
(G : Type*) [Group G]
(g h : G)
(mnpos : m > 0 ∧ n > 0)
(mngcd : Nat.gcd m n = 1)
(ha : ∀ k : Set.Icc 1 n, a k = Int.floor (m * k / (n : ℝ)) - Int.floor (m * ((k : ℤ) - 1) / (n : ℝ)))
(ghprod : ((List.Ico 1 (n + 1)).map (fun k : ℕ => g * h ^ (a k))).prod = 1)
: g * h = h * g := by
Problem: putnam_2018_a5
Category: analysis

Let $f: \mathbb{R} \to \mathbb{R}$ be an infinitely differentiable function satisfying $f(0) = 0$, $f(1)= 1$, and $f(x) \geq 0$ for all $x \in \mathbb{R}$. Show that there exist a positive integer $n$ and a real number $x$ such that $f^{(n)}(x) < 0$.


Lean 4 formalization:
import Mathlib

theorem putnam_2018_a5
(f : ℝ → ℝ)
(h0 : f 0 = 0)
(h1 : f 1 = 1)
(hpos : ∀ x : ℝ, f x ≥ 0)
(hf : ContDiff ℝ ⊤ f)
: ∃ n > 0, ∃ x : ℝ, iteratedDeriv n f x < 0 := by
Problem: putnam_2018_a6
Category: geometry, algebra

Suppose that $A$, $B$, $C$, and $D$ are distinct points, no three of which lie on a line, in the Euclidean plane. Show that if the squares of the lengths of the line segments $AB$, $AC$, $AD$, $BC$, $BD$, and $CD$ are rational numbers, then the quotient $\frac{\text{area}(\triangle ABC)}{\text{area}(\triangle ABD)}$ is a rational number.


Lean 4 formalization:
import Mathlib

theorem putnam_2018_a6
  (A B C D : EuclideanSpace ℝ (Fin 2))
  (PPprops : (EuclideanSpace ℝ (Fin 2)) → (EuclideanSpace ℝ (Fin 2)) → Prop)
  (hPPprops : ∀ P1 P2, PPprops P1 P2 ↔ P1 ≠ P2 ∧ (∃ q : ℚ, (dist P1 P2) ^ 2 = q))
  (ABCDnoline : ¬Collinear ℝ {A, B, C} ∧ ¬Collinear ℝ {A, B, D} ∧ ¬Collinear ℝ {A, C, D} ∧ ¬Collinear ℝ {B, C, D})
  (ABCDsqrrat : PPprops A B ∧ PPprops A C ∧ PPprops A D ∧ PPprops B C ∧ PPprops B D ∧ PPprops C D) :
  ∃ q : ℚ, (MeasureTheory.volume (convexHull ℝ {A, B, C}) / MeasureTheory.volume (convexHull ℝ {A, B, D})).toReal = q := by
Problem: putnam_2018_b1
Category: algebra

Let $\mathcal{P}$ be the set of vectors defined by $\mathcal{P}=\left\{\left.\begin{pmatrix} a \\ b \end{pmatrix}\right| 0 \leq a \leq 2, 0 \leq b \leq 100,\text{ and }a,b \in \mathbb{Z}\right\}$. Find all $\mathbf{v} \in \mathcal{P}$ such that the set $\mathcal{P} \setminus \{\mathbf{v}\}$ obtained by omitting vector $\mathbf{v}$ from $\mathcal{P}$ can be partitioned into two sets of equal size and equal sum.

Solution: Show that the answer is the collection of vectors $\begin{pmatrix} 1 \\ b \end{pmatrix}$ where $0 \leq b \leq 100$ and $b$ is even.

Lean 4 formalization:
import Mathlib

abbrev putnam_2018_b1_solution : Set (Fin 2 → ℤ) := sorry

theorem putnam_2018_b1
(P Pvdiff : Finset (Fin 2 → ℤ))
(v : Fin 2 → ℤ)
(hP : P = {v' : Fin 2 → ℤ | 0 ≤ v' 0 ∧ v' 0 ≤ 2 ∧ 0 ≤ v' 1 ∧ v' 1 ≤ 100})
(hPvdiff : Pvdiff = P \ ({v} : Finset (Fin 2 → ℤ)))
: (v ∈ P ∧ (∃ Q R : Finset (Fin 2 → ℤ),
    (Q ∪ R = Pvdiff) ∧ (Q ∩ R = ∅) ∧ (Q.card = R.card) ∧
    (∑ q ∈ Q, q 0 = ∑ r ∈ R, r 0) ∧ (∑ q ∈ Q, q 1 = ∑ r ∈ R, r 1)))
  ↔ v ∈ putnam_2018_b1_solution := by
Problem: putnam_2018_b2
Category: analysis

Let $n$ be a positive integer, and let $f_n(z) = n + (n-1)z + (n-2)z^2 + \cdots + z^{n-1}$. Prove that $f_n$ has no roots in the closed unit disk $\{z \in \mathbb{C}: |z| \leq 1\}$.


Lean 4 formalization:
import Mathlib

theorem putnam_2018_b2
(n : ℕ)
(hn : n > 0)
(f : ℕ → ℂ → ℂ)
(hf : ∀ z : ℂ, f n z = ∑ i ∈ Finset.range n, (n - i) * z^i)
: ∀ z : ℂ, ‖z‖ ≤ 1 → f n z ≠ 0 := by
Problem: putnam_2018_b3
Category: number_theory

Find all positive integers $n < 10^{100}$ for which simultaneously $n$ divides $2^n$, $n-1$ divides $2^n-1$, and $n-2$ divides $2^n - 2$.

Solution: Show that the solution is the set $\{2^2, 2^4, 2^8, 2^16\}$.

Lean 4 formalization:
import Mathlib

abbrev putnam_2018_b3_solution : Set ℕ := sorry
theorem putnam_2018_b3
  (n : ℕ) (hn : 0 < n) :
  (n < 10^100 ∧ ((n : ℤ) ∣ (2^n : ℤ) ∧ (n - 1 : ℤ) ∣ (2^n - 1 : ℤ) ∧ (n - 2 : ℤ) ∣ (2^n - 2 : ℤ))) ↔ n ∈ putnam_2018_b3_solution := by
Problem: putnam_2018_b4
Category: algebra

Given a real number $a$, we define a sequence by $x_0 = 1$, $x_1 = x_2 = a$, and $x_{n+1} = 2x_n x_{n-1} - x_{n-2}$ for $n \geq 2$. Prove that if $x_n = 0$ for some $n$, then the sequence is periodic.


Lean 4 formalization:
import Mathlib

theorem putnam_2018_b4
  (a : ℝ)
  (x : ℕ → ℝ)
  (hx0 : x 0 = 1)
  (hx12 : x 1 = a ∧ x 2 = a)
  (hxn : ∀ n, x (n + 3) = 2 * (x (n + 2)) * (x (n + 1)) - x n) :
  (∃ n, x n = 0) → (∃ c, c > 0 ∧ Function.Periodic x c) := by
Problem: putnam_2018_b5
Category: analysis

Let $f=(f_1,f_2)$ be a function from $\mathbb{R}^2$ to $\mathbb{R}^2$ with continuous partial derivatives $\frac{\partial f_i}{\partial x_j}$ that are positive everywhere. Suppose that $\frac{\partial f_1}{\partial x_1} \frac{\partial f_2}{\partial x_2}-\frac{1}{4}\left(\frac{\partial f_1}{\partial x_2}+\frac{\partial f_2}{\partial x_1}\right)^2>0$ everywhere. Prove that $f$ is one-to-one.


Lean 4 formalization:
import Mathlib

open Function

theorem putnam_2018_b5
    (f : (Fin 2 → ℝ) → (Fin 2 → ℝ))
    (h₁ : ContDiff ℝ 1 f)
    (h₂ : ∀ x i j, 0 < fderiv ℝ f x (Pi.single i 1) j)
    (h₃ : ∀ x, 0 < fderiv ℝ f x ![1, 0] 0 * fderiv ℝ f x ![0, 1] 1 -
      (1 / 4) * (fderiv ℝ f x ![1, 0] 1 + fderiv ℝ f x ![0, 1] 0) ^ 2) :
    Injective f := by
Problem: putnam_2018_b6
Category: algebra

Let $S$ be the set of sequences of length $2018$ whose terms are in the set $\{1,2,3,4,5,6,10\}$ and sum to $3860$. Prove that the cardinality of $S$ is at most $2^{3860} \cdot \left(\frac{2018}{2048}\right)^{2018}$.


Lean 4 formalization:
import Mathlib

theorem putnam_2018_b6
  (S : Finset (Fin 2018 → ℤ))
  (hS : S = {s : Fin 2018 → ℤ | (∀ i : Fin 2018, s i ∈ ({1, 2, 3, 4, 5, 6, 10} : Set ℤ)) ∧ (∑ i : Fin 2018, s i) = 3860}) :
  S.card ≤ 2 ^ 3860 * ((2018 : ℝ) / 2048) ^ 2018 := by
Problem: putnam_2019_a1
Category: algebra

Determine all possible values of the expression
\[
A^3+B^3+C^3-3ABC
\]
where $A, B$, and $C$ are nonnegative integers.

Solution: The answer is all nonnegative integers not congruent to $3$ or $6 \pmod{9}$.

Lean 4 formalization:
import Mathlib

open Topology Filter

abbrev putnam_2019_a1_solution : Set ℤ := sorry
theorem putnam_2019_a1
: {n : ℤ | ∃ A B C : ℤ, A ≥ 0 ∧ B ≥ 0 ∧ C ≥ 0 ∧ A^3 + B^3 + C^3 - 3*A*B*C = n} = putnam_2019_a1_solution := by
Problem: putnam_2019_a3
Category: algebra

Given real numbers $b_0, b_1, \dots, b_{2019}$ with $b_{2019} \neq 0$, let $z_1,z_2,\dots,z_{2019}$ be
the roots in the complex plane of the polynomial
\[
P(z) = \sum_{k=0}^{2019} b_k z^k.
\]
Let $\mu = (|z_1| + \cdots + |z_{2019}|)/2019$ be the average of the distances from $z_1,z_2,\dots,z_{2019}$ to the origin. Determine the largest constant $M$ such that $\mu \geq M$ for all choices of $b_0,b_1,\dots, b_{2019}$ that satisfy
\[
1 \leq b_0 < b_1 < b_2 < \cdots < b_{2019} \leq 2019.
\]

Solution: The answer is $M = 2019^{-1/2019}$.

Lean 4 formalization:
import Mathlib

open Topology Filter

noncomputable abbrev putnam_2019_a3_solution : ℝ := sorry
theorem putnam_2019_a3
  (v : Polynomial ℂ → Prop)
  (hv : v = fun b => b.degree = 2019 ∧ 1 ≤ (b.coeff 0).re ∧ (b.coeff 2019).re ≤ 2019 ∧
    (∀ i : Fin 2020, (b.coeff i).im = 0) ∧ (∀ i : Fin 2019, (b.coeff i).re < (b.coeff (i + 1)).re))
  (μ : Polynomial ℂ → ℝ)
  (hμ : μ = fun b => (Multiset.map (fun ω : ℂ => ‖ω‖) (Polynomial.roots b)).sum/2019) :
  IsGreatest {M : ℝ | ∀ b, v b → μ b ≥ M} putnam_2019_a3_solution := by
Problem: putnam_2019_a4
Category: analysis

Let $f$ be a continuous real-valued function on $\mathbb{R}^3$. Suppose that for every sphere $S$ of radius $1$, the integral of $f(x,y,z)$ over the surface of $S$ equals $0$. Must $f(x,y,z)$ be identically 0?

Solution: Show that the answer is no.

Lean 4 formalization:
import Mathlib

open MeasureTheory Metric Topology Filter

abbrev putnam_2019_a4_solution : Prop := sorry
theorem putnam_2019_a4
    (P : (EuclideanSpace ℝ (Fin 3) → ℝ) → Prop)
    (P_def : ∀ f, P f ↔ ∀ C, ∫ x in sphere C 1, f x ∂μH[2] = 0) :
    (∀ f, Continuous f → P f → f = 0) ↔ putnam_2019_a4_solution := by
Problem: putnam_2019_a5
Category: abstract_algebra, number_theory, algebra

Let $p$ be an odd prime number, and let $\mathbb{F}_p$ denote the field of integers modulo $p$. Let $\mathbb{F}_p[x]$ be the ring of polynomials over $\mathbb{F}_p$, and let $q(x) \in \mathbb{F}_p[x]$ be given by $q(x)=\sum_{k=1}^{p-1} a_kx^k$, where $a_k=k^{(p-1)/2}\mod{p}$. Find the greatest nonnegative integer $n$ such that $(x-1)^n$ divides $q(x)$ in $\mathbb{F}_p[x]$.

Solution: Show that the answer is $\frac{p-1}{2}$.

Lean 4 formalization:
import Mathlib

open Topology Filter

abbrev putnam_2019_a5_solution : ℕ → ℕ := sorry
theorem putnam_2019_a5
  (p : ℕ)
  (q : Polynomial (ZMod p))
  (a : ℕ → ZMod p)
  (npoly : ℕ → Polynomial (ZMod p))
  (podd : Odd p)
  (pprime : p.Prime)
  (hq : ∀ k : ℕ, q.coeff k = a k)
  (ha0 : a 0 = 0 ∧ ∀ k > p - 1, a k = 0)
  (haother : ∀ k : Set.Icc 1 (p - 1), a k = ((k : ℕ) ^ ((p - 1) / 2)) % p)
  (hnpoly : ∀ n : ℕ, npoly n = (Polynomial.X - 1) ^ n) :
  IsGreatest {n | npoly n ∣ q} (putnam_2019_a5_solution p) := by
Problem: putnam_2019_a6
Category: analysis

Let \( g \) be a real-valued function that is continuous on the closed interval \([0,1]\) and twice differentiable on the open interval \((0,1)\). Suppose that for some real number $\( r > 1 \),\lim_{{x \to 0^+}} \frac{g(x)}{x^r} = 0.$ Prove that either $\lim_{{x \to 0^+}} g'(x) = 0$ or $\limsup_{{x \to 0^+}} x^r |g''(x)| = \infty.$


Lean 4 formalization:
import Mathlib

open Topology Filter

theorem putnam_2019_a6
(g : ℝ → ℝ)
(r : ℝ)
(hcont : ContinuousOn g (Set.Icc 0 1))
(hdiff : ContDiffOn ℝ 1 g (Set.Ioo 0 1) ∧ DifferentiableOn ℝ (deriv g) (Set.Ioo 0 1))
(hr : r > 1)
(hlim : Tendsto (fun x => g x / x ^ r) (𝓝[>] 0) (𝓝 0))
: (Tendsto (deriv g) (𝓝[>] 0) (𝓝 0)) ∨ (Tendsto (fun x : ℝ => sSup {((x' ^ r * abs (iteratedDeriv 2 g x') : ℝ) : WithTop ℝ) | x' ∈ Set.Ioc 0 x}) (𝓝[>] 0) atTop) := by
Problem: putnam_2019_b1
Category: geometry

Denote by $\mathbb{Z}^2$ the set of all points $(x,y)$ in the plane with integer coordinates. For each integer $n \geq 0$, let $P_n$ be the subset of $\mathbb{Z}^2$ consisting of the point $(0,0)$ together with all points $(x,y)$ such that $x^2+y^2=2^k$ for some integer $k \leq n$. Determine, as a function of $n$, the number of four-point subsets of $P_n$ whose elements are the vertices of a square.

Solution: Show that the answer is $5n+1$.

Lean 4 formalization:
import Mathlib

open Topology Filter

abbrev putnam_2019_b1_solution : ℕ → ℕ := sorry
theorem putnam_2019_b1
(n : ℕ)
(Pn : Set (Fin 2 → ℤ))
(pZtoR : (Fin 2 → ℤ) → EuclideanSpace ℝ (Fin 2))
(sPnsquare : Finset (Fin 2 → ℤ) → Prop)
(hPn : Pn = {p | (p 0 = 0 ∧ p 1 = 0) ∨ (∃ k ≤ n, (p 0) ^ 2 + (p 1) ^ 2 = 2 ^ k)})
(hpZtoR : ∀ p i, (pZtoR p) i = p i)
(sPnsquare_def : ∀ sPn : Finset (Fin 2 → ℤ), sPnsquare sPn ↔ (sPn.card = 4 ∧ ∃ p4 : Fin 4 → (Fin 2 → ℤ), Set.range p4 = sPn ∧ (∃ s > 0, ∀ i : Fin 4, dist (pZtoR (p4 i) : EuclideanSpace ℝ (Fin 2)) (pZtoR (p4 (i + 1))) = s) ∧ (dist (pZtoR (p4 0)) (pZtoR (p4 2)) = dist (pZtoR (p4 1)) (pZtoR (p4 3)))))
: {sPn : Finset (Fin 2 → ℤ) | (sPn : Set (Fin 2 → ℤ)) ⊆ Pn ∧ sPnsquare sPn}.encard = putnam_2019_b1_solution n := by
Problem: putnam_2019_b2
Category: analysis

For all $n \geq 1$, let
\[
a_n = \sum_{k=1}^{n-1} \frac{\sin \left( \frac{(2k-1)\pi}{2n} \right)}{\cos^2 \left( \frac{(k-1)\pi}{2n} \right) \cos^2 \left( \frac{k\pi}{2n} \right)}.
\]
Determine
\[
\lim_{n \to \infty} \frac{a_n}{n^3}.
\]

Solution: The answer is $\frac{8}{\pi^3}$.

Lean 4 formalization:
import Mathlib

open Topology Filter Set

noncomputable abbrev putnam_2019_b2_solution : ℝ := sorry
theorem putnam_2019_b2
(a : ℕ → ℝ)
(ha : a = fun n : ℕ => ∑ k : Icc (1 : ℤ) (n - 1),
Real.sin ((2*k - 1)*Real.pi/(2*n))/((Real.cos ((k - 1)*Real.pi/(2*n))^2)*(Real.cos (k*Real.pi/(2*n))^2)))
: Tendsto (fun n : ℕ => (a n)/n^3) atTop (𝓝 putnam_2019_b2_solution) := by
Problem: putnam_2019_b3
Category: linear_algebra

Let $Q$ be an $n$-by-$n$ real orthogonal matrix, and let $u \in \mathbb{R}^n$ be a unit column vector (that is, $u^T u = 1$). Let $P = I - 2uu^T$, where $I$ is the $n$-by-$n$ identity matrix. Show that if $1$ is not an eigenvalue of $Q$, then $1$ is an eigenvalue of $PQ$.


Lean 4 formalization:
import Mathlib

open Topology Filter Set Matrix

theorem putnam_2019_b3
(n : ℕ)
(hn : n > 0)
(Q : Matrix (Fin n) (Fin n) ℝ)
(hQ0 : ∀ i j : Fin n, i ≠ j → dotProduct (Q i) (Q j) = 0 ∧ dotProduct (Qᵀ i) (Qᵀ j) = 0)
(hQ1 : ∀ i : Fin n, dotProduct (Q i) (Q i) = 1 ∧ dotProduct (Qᵀ i) (Qᵀ i) = 1)
(u : Matrix (Fin n) (Fin 1) ℝ)
(hu : uᵀ*u = 1)
(P : Matrix (Fin n) (Fin n) ℝ)
(hP : P = 1 - 2 * (u * uᵀ))
: (Q - 1).det ≠ 0 → (P * Q - 1).det = 0 := by
Problem: putnam_2019_b4
Category: analysis

Let $\mathcal{F}$ be the set of functions $f(x,y)$ that are twice continuously differentiable for $x \geq 1,y \geq 1$ and that satisfy the following two equations (where subscripts denote partial derivatives):
\begin{gather*}
xf_x+yf_y=xy\ln(xy), \\
x^2f_{xx}+y^2f_{yy}=xy.
\end{gather*}
For each $f \in \mathcal{F}$, let $m(f)=\min_{s \geq 1} (f(s+1,s+1)-f(s+1,s)-f(s,s+1)+f(s,s))$. Determine $m(f)$, and show that it is independent of the choice of $f$.

Solution: Show that $m(f)=2\ln 2-\frac{1}{2}$.

Lean 4 formalization:
import Mathlib

open Topology Filter Set Matrix

noncomputable abbrev putnam_2019_b4_solution : ℝ := sorry
theorem putnam_2019_b4
(f : (Fin 2 → ℝ) → ℝ)
(vec : ℝ → ℝ → (Fin 2 → ℝ))
(fdiff : ContDiff ℝ 2 f)
(hvec : ∀ x y : ℝ, (vec x y) 0 = x ∧ (vec x y 1) = y)
(feq1 : ∀ x ≥ 1, ∀ y ≥ 1, x * deriv (fun x' : ℝ => f (vec x' y)) x + y * deriv (fun y' : ℝ => f (vec x y')) y = x * y * Real.log (x * y))
(feq2 : ∀ x ≥ 1, ∀ y ≥ 1, x ^ 2 * iteratedDeriv 2 (fun x' : ℝ => f (vec x' y)) x + y ^ 2 * iteratedDeriv 2 (fun y' : ℝ => f (vec x y')) y = x * y)
: sInf {f (vec (s + 1) (s + 1)) - f (vec (s + 1) s) - f (vec s (s + 1)) + f (vec s s) | s ≥ 1} = putnam_2019_b4_solution := by
Problem: putnam_2019_b5
Category: number_theory, algebra

Let $F_m$ be the $m$th Fibonacci number, defined by $F_1 = F_2 = 1$ and $F_m = F_{m-1} + F_{m-2}$ for all $m \geq 3$. Let $p(x)$ be the polynomial of degree $1008$ such that $p(2n + 1) = F_{2n+1}$ for $n = 0,1,2,\ldots,1008$. Find integers $j$ and $k$ such that $p(2019) = F_j - F_k$.

Solution: Show that the solution takes the form of $(j, k) = (2019, 1010)$.

Lean 4 formalization:
import Mathlib

open Topology Filter Set Matrix

abbrev putnam_2019_b5_solution : ℕ × ℕ := sorry
theorem putnam_2019_b5
(F : ℕ → ℤ)
(P : Polynomial ℝ)
(hF : ∀ x, x ≥ 1 → F (x + 2) = F (x + 1) + F x)
(F12 : F 1 = 1 ∧ F 2 = 1)
(Pdeg: Polynomial.degree P = 1008)
(hp: ∀ n : ℕ, (n ≤ 1008) → P.eval (2 * n + 1 : ℝ) = F (2 * n + 1))
: ∀ j k : ℕ, (P.eval 2019 = F j - F k ∧ 1 ≤ j ∧ 1 ≤ k) ↔ ⟨j, k⟩ = putnam_2019_b5_solution  := by
Problem: putnam_2019_b6
Category: algebra

Let \( \mathbb{Z}^n \) be the integer lattice in \( \mathbb{R}^n \). Two points in \( \mathbb{Z}^n \) are called neighbors if they differ by exactly 1 in one coordinate and are equal in all other coordinates. For which integers \( n \geq 1 \) does there exist a set of points \( S \subset \mathbb{Z}^n \) satisfying the following two conditions? \begin{enumerate} \item If \( p \) is in \( S \), then none of the neighbors of \( p \) is in \( S \). \item If \( p \in \mathbb{Z}^n \) is not in \( S \), then exactly one of the neighbors of \( p \) is in \( S \). \end{enumerate}

Solution: Show that the statement is true for every \(n \geq 1\)

Lean 4 formalization:
import Mathlib

open Topology Filter Set Matrix

abbrev putnam_2019_b6_solution : Set ℕ := sorry
theorem putnam_2019_b6
  (n : ℕ)
  (neighbors : (Fin n → ℤ) → (Fin n → ℤ) → Prop)
  (neighbors_def : ∀ p q, neighbors p q ↔ (∃ i : Fin n, abs (p i - q i) = 1 ∧ ∀ j ≠ i, p j = q j)) :
  (1 ≤ n ∧ ∃ S : Set (Fin n → ℤ),
    (∀ p ∈ S, ∀ q, neighbors p q → q ∉ S) ∧ (∀ p ∉ S, {q ∈ S | neighbors p q}.encard = 1))
  ↔ n ∈ putnam_2019_b6_solution := by
Problem: putnam_2020_a1
Category: number_theory, algebra

Find the number of positive integers $N$ satisfying: (i) $N$ is divisible by $2020$, (ii) $N$ has at most $2020$ decimal digits, (iii) The decimal digits of $N$ are a string of consecutive ones followed by a string of consecutive zeros.

Solution: Show that the solution is $508536$.

Lean 4 formalization:
import Mathlib

abbrev putnam_2020_a1_solution : ℕ := sorry
theorem putnam_2020_a1
: Set.ncard {x : ℕ | (2020 ∣ x) ∧ (Nat.log 10 x) + 1 ≤ 2020 ∧ (∃ k l, k ≥ l ∧ x = ∑ i ∈ Finset.range (k-l+1), 10 ^ (i+l))} = putnam_2020_a1_solution := by
Problem: putnam_2020_a2
Category: algebra

Let $k$ be a nonnegative integer. Evaluate
\[
\sum_{j=0}^k 2^{k-j} \binom{k+j}{j}.
\]


Solution: Show that the answer is $4^k$.

Lean 4 formalization:
import Mathlib

abbrev putnam_2020_a2_solution : ℕ → ℕ := sorry
theorem putnam_2020_a2
(k : ℕ)
: (∑ j ∈ Finset.Icc 0 k, 2 ^ (k - j) * Nat.choose (k + j) j = putnam_2020_a2_solution k) := by
Problem: putnam_2020_a3
Category: analysis

Let $a_0 = \pi/2$, and let $a_n = \sin(a_{n-1})$ for $n \geq 1$. Determine whether
\[
\sum_{n=1}^\infty a_n^2
\]
converges.

Solution: The series diverges.

Lean 4 formalization:
import Mathlib

open Filter Topology Set

abbrev putnam_2020_a3_solution : Prop := sorry
theorem putnam_2020_a3
  (a : ℕ → ℝ)
  (ha0 : a 0 = Real.pi / 2)
  (ha : ∀ n, a (n+1) = Real.sin (a n)) :
  (∃ L, Tendsto (fun m : ℕ => ∑ n ∈ Finset.Icc 1 m, (a n)^2) atTop (𝓝 L)) ↔ putnam_2020_a3_solution := by
Problem: putnam_2020_a5
Category: number_theory, combinatorics

Let $a_n$ be the number of sets $S$ of positive integers for which
\[
\sum_{k \in S} F_k = n,
\]
where the Fibonacci sequence $(F_k)_{k \geq 1}$ satisfies $F_{k+2} = F_{k+1} + F_k$ and begins $F_1 = 1, F_2 = 1, F_3 = 2, F_4 = 3$. Find the largest integer $n$ such that $a_n = 2020$.

Solution: The answer is $n=F_{4040}-1$.

Lean 4 formalization:
import Mathlib

open Filter Topology Set

abbrev putnam_2020_a5_solution : ℤ := sorry
theorem putnam_2020_a5
  (a : ℤ → ℕ)
  (ha : a = fun n : ℤ => {S : Finset ℕ | (∀ k ∈ S, k > 0) ∧ ∑ k : S, Nat.fib k = n}.ncard) :
  IsGreatest {n | a n = 2020} putnam_2020_a5_solution := by
Problem: putnam_2020_a6
Category: algebra

For a positive integer $N$, let $f_N$ be the function defined by
\[
f_N(x) = \sum_{n=0}^N \frac{N+1/2-n}{(N+1)(2n+1)} \sin((2n+1)x).
\]
Determine the smallest constant $M$ such that $f_N(x) \leq M$ for all $N$ and all real $x$.

Solution: The smallest constant $M$ is $\pi/4$.

Lean 4 formalization:
import Mathlib

open Filter Topology Set

noncomputable abbrev putnam_2020_a6_solution : ℝ := sorry
theorem putnam_2020_a6
  (f : ℤ → (ℝ → ℝ))
  (hf : f = fun N : ℤ => fun x : ℝ =>
    ∑ n ∈ Finset.Icc 0 N, (N + 1/2 - n)/((N + 1)*(2*n + 1)) * Real.sin ((2*n + 1)*x))
  : putnam_2020_a6_solution = sSup {y | ∃ᵉ (N > 0) (x : ℝ), y = f N x} := by
Problem: putnam_2020_b1
Category: algebra

For a positive integer $n$, define $d(n)$ to be the sum of the digits of $n$ when written in binary (for example, $d(13) = 1+1+0+1=3)$. Let
\[
S = \sum_{k=1}^{2020} (-1)^{d(k)} k^3.
\]
Determine $S$ modulo 2020.

Solution: The answer is $1990$.

Lean 4 formalization:
import Mathlib

open Filter Topology Set

abbrev putnam_2020_b1_solution : ℕ := sorry
theorem putnam_2020_b1
(d : ℕ → ℕ)
(S : ℤ)
(hd : d = fun n : ℕ => ∑ i : Fin (Nat.digits 2 n).length, (Nat.digits 2 n)[i]!)
(hS : S = ∑ k : Icc 1 2020, ((-1 : ℤ)^(d k))*(k : ℤ)^3)
: S % 2020 = putnam_2020_b1_solution := by