purewhite42/formal_problem_solving_main huggingface dataset:
Problem: For any square matrix $A$, we can define $\sin A$ by the usual power series: $\sin A=\sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)!}A^{2n+1}$. Prove or disprove: there exists a $2 \times 2$ matrix $A$ with real entries such that $\sin A=\begin{pmatrix} 1 & 1996 \\ 0 & 1 \end{pmatrix}$.

Answer: False

Lean 4 formalization:
open Function Nat
Hypotheses: t: Matrix (Fin 2) (Fin 2) ℝ → Matrix (Fin 2) (Fin 2) ℝ
name: matsin
t: Matrix (Fin 2) (Fin 2) ℝ
name: mat1996
t: ∀ A, matsin A = ∑' n : ℕ, ((-(1 : ℝ)) ^ n / (2 * n + 1)!) • A ^ (2 * n + 1)
name: hmatsin
t: mat1996 0 0 = 1 ∧ mat1996 0 1 = 1996 ∧ mat1996 1 0 = 0 ∧ mat1996 1 1 = 1
name: hmat1996
Conclusions: ((∃ A, matsin A = mat1996) ↔ answer)
Answer type: Prop
Formal answer: answer = False
Problem: Given a finite string $S$ of symbols $X$ and $O$, we write $\Delta(S)$ for the number of $X$'s in $S$ minus the number of $O$'s. For example, $\Delta(XOOXOOX)=-1$. We call a string $S$ \emph{balanced} if every substring $T$ of (consecutive symbols of) $S$ has $-2 \leq \Delta(T) \leq 2$. Thus, $XOOXOOX$ is not balanced, since it contains the substring $OOXOO$. Find, with proof, the number of balanced strings of length $n$.

Answer: $2^{\lfloor (n + 2) / 2 \rfloor} + 2^{\lfloor (n + 1) / 2 \rfloor} - 2$

Lean 4 formalization:
open Function Nat
Independent variables: t: ℕ
name: n
Hypotheses: t: (Fin n → ℤˣ) → Fin n → Fin n → ℤ
name: Δ
t: (Fin n → ℤˣ) → Prop
name: balanced
t: ∀ S, ∀ a b, a ≤ b → Δ S a b = ∑ i in Finset.Icc a b, (S i : ℤ)
name: hΔ
t: ∀ S, balanced S ↔ ∀ a b, a ≤ b → |Δ S a b| ≤ 2
name: hbalanced
Conclusions: ({S : Fin n → ℤˣ | balanced S}.ncard = answer n)
Answer type: ℕ → ℕ
Formal answer: answer = fun (n : ℕ) =>
  ((((2 : ℕ) ^ (⌊((n + (2 : ℕ) : ℕ) / (2 : ℕ) : ℕ)⌋₊ : ℕ) : ℕ) +
          ((2 : ℕ) ^ (⌊((n + (1 : ℕ) : ℕ) / (2 : ℕ) : ℕ)⌋₊ : ℕ) : ℕ) :
        ℕ) -
      (2 : ℕ) :
    ℕ)
Problem: Evaluate \begin{gather*} \int_0^\infty \left(x-\frac{x^3}{2}+\frac{x^5}{2\cdot 4}-\frac{x^7}{2\cdot 4\cdot 6}+\cdots\right) \\ \left(1+\frac{x^2}{2^2}+\frac{x^4}{2^2\cdot 4^2}+\frac{x^6}{2^2\cdot 4^2 \cdot 6^2}+\cdots\right)\,dx. \end{gather*}

Answer: \(\sqrt{e}\)

Lean 4 formalization:
open Filter Topology
Hypotheses: t: ℝ → ℝ
name: series1
t: ℝ → ℝ
name: series2
t: series1 = fun x => ∑' n : ℕ, (-1)^n * x^(2*n + 1)/(∏ i : Finset.range n, 2 * ((i : ℝ) + 1))
name: hseries1
t: series2 = fun x => ∑' n : ℕ, x^(2*n)/(∏ i : Finset.range n, (2 * ((i : ℝ) + 1))^2)
name: hseries2
Conclusions: (Tendsto (fun t => ∫ x in Set.Icc 0 t, series1 x * series2 x) atTop (𝓝 answer))
Answer type: ℝ
Formal answer: answer = (√(Real.exp (1 : ℝ) : ℝ) : ℝ)
Problem: Let $N_n$ denote the number of ordered $n$-tuples of positive integers $(a_1,a_2,\ldots,a_n)$ such that $1/a_1 + 1/a_2 +\ldots + 1/a_n=1$.  Determine whether $N_{10}$ is even or odd.

Answer: True

Lean 4 formalization:
open Filter Topology
Hypotheses: t: (n : ℕ+) → Set (Fin n → ℕ+)
name: N
t: N = fun (n : ℕ+) => {t : Fin n → ℕ+ | (∀ i j : Fin n, i < j → t i <= t j) ∧ (∑ i : Fin n, (1 : ℝ)/(t i) = 1) }
name: hN
Conclusions: (Odd (N 10).ncard ↔ answer)
Answer type: Prop
Formal answer: answer = True
Problem: For a positive integer $n$ and any real number $c$, define $x_k$ recursively by $x_0=0$, $x_1=1$, and for $k\geq 0$, \[x_{k+2}=\frac{cx_{k+1}-(n-k)x_k}{k+1}.\] Fix $n$ and then take $c$ to be the largest value for which $x_{n+1}=0$. Find $x_k$ in terms of $n$ and $k$, $1\leq k\leq n$.

Answer: fun n k => Nat.choose (n.toNat-1) (k.toNat-1)

Lean 4 formalization:
open Filter Topology
Independent variables: t: ℤ
name: n
Hypotheses: t: n > 0
name: hn
t: ℝ → (ℤ → ℝ)
name: x
t: ∀ c, x c 0 = 0
name: hx0
t: ∀ c, x c 1 = 1
name: hx1
t: ∀ c, ∀ k ≥ 0, x c (k + 2) = (c*(x c (k + 1)) - (n - k)*(x c k))/(k + 1)
name: hxk
t: Set ℝ
name: S
t: S = {c : ℝ | x c (n + 1) = 0}
name: hS
Conclusions: (∀ k : Set.Icc 1 n, x (sSup S) k = answer n k)
Answer type: ℤ → ℤ → ℝ
Formal answer: answer = fun (n k : ℤ) => (↑(((n.toNat : ℕ) - (1 : ℕ) : ℕ).choose ((k.toNat : ℕ) - (1 : ℕ) : ℕ) : ℕ) : ℝ)
Problem: Let $\{x\}$ denote the distance between the real number $x$ and the nearest integer.  For each positive integer $n$, evaluate \[F_n=\sum_{m=1}^{6n-1} \min(\{\frac{m}{6n}\},\{\frac{m}{3n}\}).\] (Here $\min(a,b)$ denotes the minimum of $a$ and $b$.)

Answer: fun n => n

Lean 4 formalization:
open Filter Topology
Independent variables: t: ℝ
name: r
Hypotheses: t: ℝ → ℝ
name: dist_to_int
t: dist_to_int r = |r - round r|
name: h_dist_to_int
t: ℕ → ℝ
name: F
t: F = fun (n : ℕ) => ∑ m in Finset.Icc 1 (6 * n - 1), min (dist_to_int (m/(6*n)) ) (dist_to_int (m/(3*n)))
name: hF
Conclusions: (∀ n, n > 0 → F n = answer n)
Answer type: ℕ → ℝ
Formal answer: answer = fun (n : ℕ) => (↑n : ℝ)
Problem: For each positive integer $n$, write the sum $\sum_{m=1}^n 1/m$ in the form $p_n/q_n$, where $p_n$ and $q_n$ are relatively prime positive integers.  Determine all $n$ such that 5 does not divide $q_n$.

Answer: {n | (1 ≤ n ∧ n ≤ 4) ∨ (20 ≤ n ∧ n ≤ 24) ∨ (100 ≤ n ∧ n ≤ 104) ∨ (120 ≤ n ∧ n ≤ 124)}

Lean 4 formalization:
open Filter Topology Bornology Set
Independent variables: t: ℕ
name: n
Hypotheses: t: n > 0
name: hn
Conclusions: (n ∈ answer ↔ ¬5 ∣ (∑ m in Finset.Icc 1 n, 1/m : ℚ).den)
Answer type: Set ℕ
Formal answer: answer =
  ({n : ℕ |
      (1 : ℕ) ≤ n ∧ n ≤ (4 : ℕ) ∨
        (20 : ℕ) ≤ n ∧ n ≤ (24 : ℕ) ∨ (100 : ℕ) ≤ n ∧ n ≤ (104 : ℕ) ∨ (120 : ℕ) ≤ n ∧ n ≤ (124 : ℕ)} :
    Set ℕ)
Problem: Let $A_1=0$ and $A_2=1$. For $n>2$, the number $A_n$ is defined by concatenating the decimal expansions of $A_{n-1}$ and $A_{n-2}$ from left to right.  For example $A_3=A_2 A_1=10$, $A_4=A_3 A_2 = 101$, $A_5=A_4 A_3 = 10110$, and so forth.  Determine all $n$ such that $11$ divides $A_n$.

Answer: all $n$ such that $n \equiv 1 \pmod{6}$

Lean 4 formalization:
Hypotheses: t: ℕ → List ℕ
name: A
t: A 1 = [0]
name: hA1
t: A 2 = [1]
name: hA2
t: ∀ n > 0, A (n + 2) = A (n + 1) ++ A n
name: hA
Conclusions: ({n | 1 ≤ n ∧ 11 ∣ Nat.ofDigits 10 (A n).reverse} = answer)
Answer type: Set ℕ
Formal answer: answer = ({n : ℕ | n ≡ (1 : ℕ) [MOD (6 : ℕ)]} : Set ℕ)
Problem: Find the minimum value of \[\frac{(x+1/x)^6-(x^6+1/x^6)-2}{(x+1/x)^3+(x^3+1/x^3)}\] for $x>0$.

Answer: 6

Lean 4 formalization:
open Set Function Metric
Conclusions: (sInf {((x + 1/x)^6 - (x^6 + 1/x^6) - 2)/((x + 1/x)^3 + (x^3 + 1/x^3)) | x > (0 : ℝ)} = answer)
Answer type: ℝ
Formal answer: answer = (6 : ℝ)
Problem: Given a point $(a,b)$ with $0<b<a$, determine the minimum perimeter of a triangle with one vertex at $(a,b)$, one on the $x$-axis, and one on the line $y=x$.  You may assume that a triangle of minimum perimeter exists.

Answer: $\sqrt{2a^2 + 2b^2}$ if $a > b$, otherwise $0$

Lean 4 formalization:
open Set Function Metric
Independent variables: t: ℝ
name: a
t: ℝ
name: b
Hypotheses: t: 0 < b ∧ b < a
name: hab
Conclusions: (sInf {d : ℝ | ∃ (c : ℝ) (x : ℝ), d = Real.sqrt ((a - c)^2 + (b - 0)^2) + Real.sqrt ((c - x)^2 + (0 - x)^2) + Real.sqrt ((a - x)^2 + (b - x)^2) ∧
  Real.sqrt ((a - c)^2 + (b - 0)^2) + Real.sqrt ((c - x)^2 + (0 - x)^2) > Real.sqrt ((a - x)^2 + (b - x)^2) ∧
  Real.sqrt ((a - c)^2 + (b - 0)^2) + Real.sqrt ((a - x)^2 + (b - x)^2) > Real.sqrt ((c - x)^2 + (0 - x)^2) ∧
  Real.sqrt ((c - x)^2 + (0 - x)^2) + Real.sqrt ((a - x)^2 + (b - x)^2) > Real.sqrt ((a - c)^2 + (b - 0)^2)} = answer a b)
Answer type: ℝ → ℝ → ℝ
Formal answer: answer = fun (a b : ℝ) =>
  (if a > b then (√(((2 : ℝ) * (a ^ (2 : ℕ) : ℝ) : ℝ) + ((2 : ℝ) * (b ^ (2 : ℕ) : ℝ) : ℝ) : ℝ) : ℝ) else (0 : ℝ) : ℝ)
Problem: Find necessary and sufficient conditions on positive integers $m$ and $n$ so that \[\sum_{i=0}^{mn-1} (-1)^{\lfloor i/m \rfloor +\lfloor i/n\rfloor}=0.\]

Answer: {nm | let ⟨n,m⟩ := nm; multiplicity 2 n ≠ multiplicity 2 m}

Lean 4 formalization:
open Set Function Metric
Independent variables: t: ℕ
name: n
t: ℕ
name: m
Hypotheses: t: ℕ → ℕ → ℤ
name: quantity
t: quantity = fun n m => ∑ i in Finset.range (m * n), (-1)^(i/m + i/n)
name: hquantity
t: n > 0 ∧ m > 0
name: hnm
Conclusions: (quantity n m = 0 ↔ ⟨n, m⟩ ∈ answer)
Answer type: Set (ℕ × ℕ)
Formal answer: answer = ({((n, m) : ℕ × ℕ) : ℕ × ℕ | (multiplicity (2 : ℕ) n : ℕ) ≠ (multiplicity (2 : ℕ) m : ℕ)} : Set (ℕ × ℕ))
Problem: Let $N$ be the positive integer with 1998 decimal digits, all of them 1; that is, \[N=1111\cdots 11.\] Find the thousandth digit after the decimal point of $\sqrt N$.

Answer: 1

Lean 4 formalization:
open Set Function Metric
Hypotheses: t: ℕ
name: N
t: N = ∑ i in Finset.range 1998, 10^i
name: hN
Conclusions: (answer = (Nat.floor (10^1000 * Real.sqrt N)) % 10)
Answer type: ℕ
Formal answer: answer = (1 : ℕ)
Problem: Find polynomials $f(x)$,$g(x)$, and $h(x)$, if they exist, such that for all $x$, \[|f(x)|-|g(x)|+h(x) = \begin{cases} -1 & \mbox{if $x<-1$} \\3x+2 & \mbox{if $-1 \leq x \leq 0$} \\-2x+2 & \mbox{if $x>0$.}\end{cases}\]?

Answer: True

Lean 4 formalization:
Conclusions: (answer ↔ ∃ f g h : Polynomial ℝ, ∀ x : ℝ, |f.eval x| - |g.eval x| + h.eval x = if x < -1 then -1 else (if (x ≤ 0) then 3 * x + 2 else -2 * x + 2))
Answer type: Prop
Formal answer: answer = True
Problem: Sum the series \[\sum_{m=1}^\infty \sum_{n=1}^\infty \frac{m^2 n}{3^m(n3^m+m3^n)}.\]

Answer: 9/32

Lean 4 formalization:
open Filter Topology Metric
Conclusions: (Tendsto (fun i => ∑ m in Finset.range i, ∑' n : ℕ, (((m + 1)^2*(n+1))/(3^(m + 1) * ((n+1)*3^(m + 1) + (m + 1)*3^(n+1))) : ℝ)) atTop (𝓝 answer))
Answer type: ℝ
Formal answer: answer = (9 / 32 : ℝ)
Problem: Let $A=\{(x,y):0\leq x,y<1\}$.  For $(x,y)\in A$, let \[S(x,y) = \sum_{\frac{1}{2}\leq \frac{m}{n}\leq 2} x^m y^n,\] where the sum ranges over all pairs $(m,n)$ of positive integers satisfying the indicated inequalities.  Evaluate \[\lim_{(x,y)\rightarrow (1,1), (x,y)\in A} (1-xy^2)(1-x^2y)S(x,y).\]

Answer: 3

Lean 4 formalization:
open Filter Topology Metric
Hypotheses: t: Set (ℝ × ℝ)
name: A
t: A = {xy | 0 ≤ xy.1 ∧ xy.1 < 1 ∧ 0 ≤ xy.2 ∧ xy.2 < 1}
name: hA
t: ℝ → ℝ → ℝ
name: S
t: S = fun x y => ∑' m : ℕ, ∑' n : ℕ, if (m > 0 ∧ n > 0 ∧ 1/2 ≤ m/n ∧ m/n ≤ 2) then x^m * y^n else 0
name: hS
Conclusions: (Tendsto (fun xy : (ℝ × ℝ) => (1 - xy.1 * xy.2^2) * (1 - xy.1^2 * xy.2) * (S xy.1 xy.2)) (𝓝[A] ⟨1,1⟩) (𝓝 answer))
Answer type: ℝ
Formal answer: answer = (3 : ℝ)
Problem: For an integer $n\geq 3$, let $\theta=2\pi/n$.  Evaluate the determinant of the $n\times n$ matrix $I+A$, where $I$ is the $n\times n$ identity matrix and $A=(a_{jk})$ has entries $a_{jk}=\cos(j\theta+k\theta)$ for all $j,k$.

Answer: fun n => 1 - n^2/4

Lean 4 formalization:
open Filter Topology Metric
Independent variables: t: ℕ
name: n
Hypotheses: t: n ≥ 3
name: hn
t: ℝ
name: theta
t: theta = 2 * Real.pi / n
name: htheta
t: Matrix (Fin n) (Fin n) ℝ
name: A
t: A = fun j k => Real.cos ((j.1 + 1) * theta + (k.1 + 1) * theta)
name: hA
Conclusions: ((1 + A).det = answer n)
Answer type: ℕ → ℝ
Formal answer: answer = fun (n : ℕ) => ((1 : ℝ) - (((↑n : ℝ) ^ (2 : ℕ) : ℝ) / (4 : ℝ) : ℝ) : ℝ)
Problem: Let $A$ be a positive real number. What are the possible values of $\sum_{j=0}^\infty x_j^2$, given that $x_0,x_1,\ldots$ are positive numbers for which $\sum_{j=0}^\infty x_j=A$?

Answer: the open interval $(0, A^2)$

Lean 4 formalization:
open Topology Filter
Independent variables: t: ℝ
name: A
Hypotheses: t: A > 0
name: Apos
Conclusions: ({S : ℝ |
    ∃ x : ℕ → ℝ,
      (∀ j : ℕ, x j > 0) ∧
      (∑' j : ℕ, x j) = A ∧
      (∑' j : ℕ, (x j) ^ 2) = S}
  = answer A)
Answer type: ℝ → Set ℝ
Formal answer: answer = fun (A : ℝ) => (Set.Ioo (0 : ℝ) (A ^ (2 : ℕ) : ℝ) : Set ℝ)
Problem: For each integer $m$, consider the polynomial
\[P_m(x)=x^4-(2m+4)x^2+(m-2)^2.\] For what values of $m$ is $P_m(x)$
the product of two non-constant polynomials with integer coefficients?

Answer: {m : ℤ | ∃ k : ℤ, k^2 = m ∨ 2*k^2 = m}

Lean 4 formalization:
open Topology Filter Polynomial Set
Hypotheses: t: ℤ → Polynomial ℤ
name: P
t: P = fun m : ℤ => (Polynomial.X)^4 - (Polynomial.C (2*m + 4))*(Polynomial.X)^2 + Polynomial.C ((m - 2)^2)
name: hP
Conclusions: ({m : ℤ | ∃ a b, P m = a * b ∧
(∃ n ∈ Ici 1, a.coeff n ≠ 0) ∧ (∃ n ∈ Ici 1, b.coeff n ≠ 0)} = answer)
Answer type: Set ℤ
Formal answer: answer = ({m : ℤ | ∃ (k : ℤ), (k ^ (2 : ℕ) : ℤ) = m ∨ ((2 : ℤ) * (k ^ (2 : ℕ) : ℤ) : ℤ) = m} : Set ℤ)
Problem: Find all pairs of real numbers $(x,y)$ satisfying the system of equations
\begin{align*}
\frac{1}{x}+\frac{1}{2y}&=(x^2+3y^2)(3x^2+y^2) \\
\frac{1}{x}-\frac{1}{2y}&=2(y^4-x^4).
\end{align*}

Answer: the set containing the pair $\left(\frac{3^{1/5} + 1}{2}, \frac{3^{1/5} - 1}{2}\right)$

Lean 4 formalization:
open Topology Filter Polynomial Set
Hypotheses: t: ℝ
name: x
t: ℝ
name: y
t: x ≠ 0
name: hx
t: y ≠ 0
name: hy
t: Prop
name: eq1
t: Prop
name: eq2
t: eq1 ↔ (1 / x + 1 / (2 * y) = (x ^ 2 + 3 * y ^ 2) * (3 * x ^ 2 + y ^ 2))
name: heq1
t: eq2 ↔ (1 / x - 1 / (2 * y) = 2 * (y ^ 4 - x ^ 4))
name: heq2
Conclusions: (eq1 ∧ eq2 ↔ (x, y) ∈ answer)
Answer type: Set (ℝ × ℝ)
Formal answer: answer =
  ({((((((3 : ℝ) ^ (1 / 5 : ℝ) : ℝ) + (1 : ℝ) : ℝ) / (2 : ℝ) : ℝ),
          ((((3 : ℝ) ^ (1 / 5 : ℝ) : ℝ) - (1 : ℝ) : ℝ) / (2 : ℝ) : ℝ)) :
        ℝ × ℝ)} :
    Set (ℝ × ℝ))
Problem: For any positive integer $n$, let $\langle n \rangle$ denote the closest integer to $\sqrt{n}$. Evaluate $\sum_{n=1}^\infty \frac{2^{\langle n \rangle}+2^{-\langle n \rangle}}{2^n}$.

Answer: 3

Lean 4 formalization:
open Topology Filter Polynomial Set
Conclusions: (∑' n : Set.Ici 1, ((2 : ℝ) ^ (round (Real.sqrt n)) + (2 : ℝ) ^ (-round (Real.sqrt n))) / 2 ^ (n : ℝ) = answer)
Answer type: ℝ
Formal answer: answer = (3 : ℝ)
Problem: Assume that $(a_n)_{n \geq 1}$ is an increasing sequence of positive real numbers such that $\lim a_n/n=0$. Must there exist infinitely many positive integers $n$ such that $a_{n-i}+a_{n+i}<2a_n$ for $i=1,2,\ldots,n-1$?

Answer: True

Lean 4 formalization:
open Topology Filter Polynomial Set
Hypotheses: t: ℤ → ℝ
name: a
t: ∀ n ≥ 1, a n > 0 ∧ a n < a (n + 1)
name: h_pos_inc
t: Tendsto (fun n : ℤ => a (n + 1) / (n + 1)) atTop (𝓝 0)
name: h_limit
Conclusions: ({n : ℤ | n > 0 ∧ (∀ i ∈ Set.Icc 1 (n - 1), a (n - i) + a (n + i) < 2 * a n)}.Infinite ↔ answer)
Answer type: Prop
Formal answer: answer = True
Problem: Let $k$ be a fixed positive integer. The $n$-th derivative of $\frac{1}{x^k-1}$ has the form $\frac{P_n(x)}{(x^k-1)^{n+1}}$ where $P_n(x)$ is a polynomial. Find $P_n(1)$.

Answer: (-k)^n * n!

Lean 4 formalization:
open Nat
Independent variables: t: ℕ
name: k
Hypotheses: t: ℕ → Polynomial ℝ
name: P
t: k > 0
name: kpos
t: ∀ n x, iteratedDeriv n (fun x' : ℝ => 1 / (x' ^ k - 1)) x = ((P n).eval x) / ((x ^ k - 1) ^ (n + 1))
name: Pderiv
Conclusions: (∀ n, (P n).eval 1 = answer k n)
Answer type: ℕ → ℕ → ℝ
Formal answer: answer = fun (k n : ℕ) => (((-(↑k : ℝ) : ℝ) ^ n : ℝ) * (↑(n ! : ℕ) : ℝ) : ℝ)
Problem: Fix an integer $b \geq 2$. Let $f(1) = 1$, $f(2) = 2$, and for each
$n \geq 3$, define $f(n) = n f(d)$, where $d$ is the number of
base-$b$ digits of $n$. For which values of $b$ does
\[
\sum_{n=1}^\infty \frac{1}{f(n)}
\]
converge?

Answer: {2}

Lean 4 formalization:
open Nat Set Topology Filter
Hypotheses: t: ℕ → ℕ → ℝ
name: f
t: ∀ b : ℕ, f b 1 = 1 ∧ f b 2 = 2 ∧ ∀ n ∈ Ici 3, f b n = n * f b (Nat.digits b n).length
name: hf
Conclusions: ({b ∈ Ici 2 | ∃ L : ℝ, Tendsto (fun m : ℕ => ∑ n in Finset.Icc 1 m, 1/(f b n)) atTop (𝓝 L)} = answer)
Answer type: Set ℕ
Formal answer: answer = ({(2 : ℕ)} : Set ℕ)
Problem: Let $n$ be a fixed positive integer. How many ways are there to write $n$ as a sum of positive integers, \[ n = a_1 + a_2 + \dots + a_k, \] with $k$ an arbitrary positive integer and $a_1 \leq a_2 \leq \dots \leq a_k \leq a_1 + 1$? For example, with $n = 4$, there are four ways: $4, 2 + 2, 1 + 1 + 2, 1 + 1 + 1 + 1$

Answer: $n$

Lean 4 formalization:
open MvPolynomial
Independent variables: t: ℕ
name: n
Hypotheses: t: n > 0
name: hn
Conclusions: (Set.encard {a : ℕ → ℤ |
  ∃ k > 0, (∑ i : Fin k, a i = n) ∧
    (∀ i : Fin k, a i > 0) ∧
    (∀ i : Fin (k - 1), a i ≤ a (i + 1)) ∧
    a (k - 1) ≤ a 0 + 1 ∧ (∀ i ≥ k, a i = 0)} = answer n)
Answer type: ℕ → ℕ
Formal answer: answer = fun (n : ℕ) => n
Problem: Find the minimum value of $|\sin x+\cos x+\tan x+\cot x+\sec x+\csc x|$ for real numbers $x$.

Answer: $2\sqrt{2} - 1$

Lean 4 formalization:
open Set
Hypotheses: t: ℝ → ℝ
name: f
t: ∀ x : ℝ, f x = |Real.sin x + Real.cos x + Real.tan x + 1 / Real.tan x + 1 / Real.cos x + 1 / Real.sin x|
name: hf
Conclusions: (IsLeast (Set.range f) answer)
Answer type: ℝ
Formal answer: answer = (((2 : ℝ) * (√(2 : ℝ) : ℝ) : ℝ) - (1 : ℝ) : ℝ)
Problem: For a set $S$ of nonnegative integers, let $r_S(n)$ denote the number of ordered pairs $(s_1,s_2)$ such that $s_1 \in S$, $s_2 \in S$, $s_1 \ne s_2$, and $s_1+s_2=n$. Is it possible to partition the nonnegative integers into two sets $A$ and $B$ in such a way that $r_A(n)=r_B(n)$ for all $n$?

Answer: True

Lean 4 formalization:
open MvPolynomial Set
Hypotheses: t: Set ℕ → ℕ → ℕ
name: r
t: ∀ S n, r S n = ∑' s1 : S, ∑' s2 : S, if (s1 ≠ s2 ∧ s1 + s2 = n) then 1 else 0
name: hr
Conclusions: ((∃ A B : Set ℕ, A ∪ B = ℕ ∧ A ∩ B = ∅ ∧ (∀ n : ℕ, r A n = r B n)) ↔ answer)
Answer type: Prop
Formal answer: answer = True
Problem: Do there exist polynomials $a(x), b(x), c(y), d(y)$ such that \[ 1 + xy + x^2y^2 = a(x)c(y) + b(x)d(y)\] holds identically?

Answer: False

Lean 4 formalization:
open MvPolynomial Set
Conclusions: (answer = (∃ a b c d : Polynomial ℝ, (∀ x y : ℝ, 1 + x * y + x ^ 2 * y ^ 2 = a.eval x * c.eval y + b.eval x * d.eval y)))
Answer type: Prop
Formal answer: answer = False
Problem: Basketball star Shanille O'Keal's team statistician keeps track of the number, $S(N)$, of successful free throws she has made in her first $N$ attempts of the season. Early in the season, $S(N)$ was less than $80\%$ of $N$, but by the end of the season, $S(N)$ was more than $80\%$ of $N$. Was there necessarily a moment in between when $S(N)$ was exactly $80\%$ of $N$?

Answer: True

Lean 4 formalization:
open Nat Topology Filter
Hypotheses: t: (ℕ → Fin 2) → ℕ → ℝ
name: S
t: ∀ attempts, ∀ N ≥ 1, S attempts N = (∑ i : Fin N, (attempts i).1) / N
name: hS
Conclusions: (answer ↔ (∀ attempts a b,
    (1 ≤ a ∧ a < b ∧ S attempts a < 0.8 ∧ S attempts b > 0.8) →
      (∃ c : ℕ, a < c ∧ c < b ∧ S attempts c = 0.8)))
Answer type: Prop
Formal answer: answer = True
Problem: Let $n$ be a positive integer, $n \ge 2$, and put $\theta = 2 \pi / n$. Define points $P_k = (k,0)$ in the $xy$-plane, for $k = 1, 2, \dots, n$. Let $R_k$ be the map that rotates the plane counterclockwise by the angle $\theta$ about the point $P_k$. Let $R$ denote the map obtained by applying, in order, $R_1$, then $R_2, \dots$, then $R_n$. For an arbitrary point $(x,y)$, find, and simplify, the coordinates of $R(x,y)$.

Answer: fun n z ↦ z + n

Lean 4 formalization:
open Nat Topology Filter
Independent variables: t: ℕ
name: n
Hypotheses: t: n ≥ 2
name: nge2
t: ℕ → ℂ → ℂ
name: R
t: ℕ → ℂ → ℂ
name: Rk
t: R 0 = id ∧ ∀ k : ℕ, R (k + 1) = Rk (k + 1) ∘ R k
name: hR
t: Rk = fun (k : ℕ) (Q : ℂ) ↦ k + Complex.exp (Complex.I * 2 * Real.pi / n) * (Q - k)
name: hRk
Conclusions: (R n = answer n)
Answer type: ℕ → ℂ → ℂ
Formal answer: answer = fun (n : ℕ) (z : ℂ) => (z + (↑n : ℂ) : ℂ)
Problem: Evaluate $\lim_{x \to 1^-} \prod_{n=0}^\infty \left(\frac{1+x^{n+1}}{1+x^n}\right)^{x^n}$.

Answer: 2 / e

Lean 4 formalization:
open Nat Topology Filter
Hypotheses: t: ℝ → ℝ
name: xprod
t: ∀ x ∈ Set.Ioo 0 1,
      Tendsto (fun N ↦ ∏ n in Finset.range N, ((1 + x ^ (n + 1)) / (1 + x ^ n)) ^ (x ^ n))
      atTop (𝓝 (xprod x))
name: hxprod
Conclusions: (Tendsto xprod (𝓝[<] 1) (𝓝 answer))
Answer type: ℝ
Formal answer: answer = ((2 : ℝ) / (Real.exp (1 : ℝ) : ℝ) : ℝ)
Problem: Let $\mathbf{S} = \{(a,b) | a = 1, 2, \dots,n, b = 1,2,3\}$.
A \emph{rook tour} of $\mathbf{S}$ is a polygonal path made up of line segments connecting points $p_1, p_2, \dots, p_{3n}$ in sequence such that
\begin{enumerate}
\item[(i)] $p_i \in \mathbf{S}$,
\item[(ii)] $p_i$ and $p_{i+1}$ are a unit distance apart, for
$1 \leq i <3n$,
\item[(iii)] for each $p \in \mathbf{S}$ there is a unique $i$ such that
$p_i = p$.
\end{enumerate}
How many rook tours are there that begin at $(1,1)$
and end at $(n,1)$?

Answer: fun n ↦ if n = 1 then 0 else 2 ^ (n - 2)

Lean 4 formalization:
open Nat Set
Independent variables: t: ℕ
name: n
Hypotheses: t: n > 0
name: npos
t: Set (ℤ × ℤ)
name: S
t: ℤ × ℤ → ℤ × ℤ → Prop
name: unit
t: (ℕ → ℤ × ℤ) → Prop
name: rooktour
t: S = prod (Icc 1 (n : ℤ)) (Icc 1 3)
name: hS
t: unit = fun (a, b) (c, d) ↦ a = c ∧ |d - b| = 1 ∨ b = d ∧ |c - a| = 1
name: hunit
t: rooktour = fun p ↦ (∀ P ∈ S, ∃! i, i ∈ Icc 1 (3 * n) ∧ p i = P) ∧ (∀ i ∈ Icc 1 (3 * n - 1), unit (p i) (p (i + 1))) ∧ p 0 = 0 ∧ ∀ i > 3 * n, p i = 0
name: hrooktour
Conclusions: ({p : ℕ → ℤ × ℤ | rooktour p ∧ p 1 = (1, 1) ∧ p (3 * n) = ((n : ℤ), 1)}.encard = answer n)
Answer type: ℕ → ℕ
Formal answer: answer = fun (n : ℕ) => (if n = (1 : ℕ) then (0 : ℕ) else ((2 : ℕ) ^ (n - (2 : ℕ) : ℕ) : ℕ) : ℕ)
Problem: Evaluate $\int_0^1 \frac{\ln(x+1)}{x^2+1}\,dx$.

Answer: $\frac{\pi \ln 2}{8}$

Lean 4 formalization:
open Nat Set
Conclusions: (∫ x in (0:ℝ)..1, (Real.log (x+1))/(x^2 + 1) = answer)
Answer type: ℝ
Formal answer: answer = (((Real.pi : ℝ) * (Real.log (2 : ℝ) : ℝ) : ℝ) / (8 : ℝ) : ℝ)
Problem: Find a nonzero polynomial $P(x,y)$ such that $P(\lfloor a \rfloor,\lfloor 2a \rfloor)=0$ for all real numbers $a$. (Note: $\lfloor \nu \rfloor$ is the greatest integer less than or equal to $\nu$.)

Answer: (y - 2x)(y - 2x - 1)

Lean 4 formalization:
open Nat Set
Conclusions: (answer ≠ 0)
(∀ a : ℝ, MvPolynomial.eval (fun n : Fin 2 => if (n = 0) then (Int.floor a : ℝ) else (Int.floor (2 * a))) answer = 0)
Answer type: MvPolynomial (Fin 2) ℝ
Formal answer: answer =
  (((MvPolynomial.X (1 : Fin (2 : ℕ)) : MvPolynomial (Fin (2 : ℕ)) ℝ) -
          ((2 : MvPolynomial (Fin (2 : ℕ)) ℝ) * (MvPolynomial.X (0 : Fin (2 : ℕ)) : MvPolynomial (Fin (2 : ℕ)) ℝ) :
            MvPolynomial (Fin (2 : ℕ)) ℝ) :
        MvPolynomial (Fin (2 : ℕ)) ℝ) *
      (((MvPolynomial.X (1 : Fin (2 : ℕ)) : MvPolynomial (Fin (2 : ℕ)) ℝ) -
              ((2 : MvPolynomial (Fin (2 : ℕ)) ℝ) * (MvPolynomial.X (0 : Fin (2 : ℕ)) : MvPolynomial (Fin (2 : ℕ)) ℝ) :
                MvPolynomial (Fin (2 : ℕ)) ℝ) :
            MvPolynomial (Fin (2 : ℕ)) ℝ) -
          (1 : MvPolynomial (Fin (2 : ℕ)) ℝ) :
        MvPolynomial (Fin (2 : ℕ)) ℝ) :
    MvPolynomial (Fin (2 : ℕ)) ℝ)
Problem: Find all positive integers $n,k_1,\dots,k_n$ such that $k_1+\cdots+k_n=5n-4$ and $\frac{1}{k_1}+\cdots+\frac{1}{k_n}=1$.

Answer: {(n, k) : ℕ × (ℕ → ℤ) | (n = 1 ∧ k 0 = 1) ∨ (n = 3 ∧ (k '' {0, 1, 2} = {2, 3, 6})) ∨ (n = 4 ∧ (∀ i : Fin 4, k i = 4))}

Lean 4 formalization:
open Nat Set
Conclusions: ({((n : ℕ), (k : ℕ → ℤ)) | (n > 0) ∧ (∀ i ∈ Finset.range n, k i > 0) ∧ (∑ i in Finset.range n, k i = 5 * n - 4) ∧ (∑ i : Finset.range n, (1 : ℝ) / (k i) = 1)} = answer)
Answer type: Set (ℕ × (ℕ → ℤ))
Formal answer: answer =
  ({((n, k) : ℕ × (ℕ → ℤ)) : ℕ × (ℕ → ℤ) |
      n = (1 : ℕ) ∧ (k (0 : ℕ) : ℤ) = (1 : ℤ) ∨
        n = (3 : ℕ) ∧
            (k '' (Insert.insert (0 : ℕ) (Insert.insert (1 : ℕ) ({(2 : ℕ)} : Set ℕ) : Set ℕ) : Set ℕ) : Set ℤ) =
              (Insert.insert (2 : ℤ) (Insert.insert (3 : ℤ) ({(6 : ℤ)} : Set ℤ) : Set ℤ) : Set ℤ) ∨
          n = (4 : ℕ) ∧ ∀ (i : Fin (4 : ℕ)), (k (↑i : ℕ) : ℤ) = (4 : ℤ)} :
    Set (ℕ × (ℕ → ℤ)))
Problem: Find all differentiable functions $f:(0,\infty) \to (0,\infty)$ for which there is a positive real number $a$ such that $f'(\frac{a}{x})=\frac{x}{f(x)}$ for all $x>0$.

Answer: the set of functions $f$ such that $f(x) = c x^d$ for some $c > 0$ and $d > 0$, with $d = 1$ implying $c = 1$

Lean 4 formalization:
open Nat Set
Independent variables: t: ℝ → ℝ
name: f
Hypotheses: t: ∀ x > 0, 0 < f x
name: hf
t: DifferentiableOn ℝ f (Ioi 0)
name: hf'
Conclusions: ((∃ a > 0, ∀ x > 0, deriv f (a / x) = x / f x) ↔ f ∈ answer)
Answer type: Set (ℝ → ℝ)
Formal answer: answer =
  ({f : ℝ → ℝ |
      ∃ c > (0 : ℝ),
        ∃ d > (0 : ℝ),
          (d = (1 : ℝ) → c = (1 : ℝ)) ∧ Set.EqOn f (fun (x : ℝ) => (c * (x ^ d : ℝ) : ℝ)) (Set.Ioi (0 : ℝ) : Set ℝ)} :
    Set (ℝ → ℝ))