/-
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.
-/
module
public import FormalConjecturesUtilWays of writing $n$ as an ordered sum of a triangular, square, and pentagonal number
The sequence $a(n)$ counts the number of tuples $(i, j, k) \in \mathbb{N}^3$ such that $T_i + S_j + P_k = n$, where $T_i = i(i+1)/2$, $S_j = j^2$, and $P_k = k(3k-1)/2$: $$a(n) = |{(i, j, k) \in \mathbb{N}^3 : i(i+1)/2 + j^2 + k(3k-1)/2 = n}|$$
References:
On universal sums of polygonal numbers by Zhi-Wei Sun, Sci. China Math. 58 (2015), 1367–1396.
@[expose] public sectionnamespace OeisA240088open FinsetNumber of ways of writing $n$ as an ordered sum of a triangular number, a square, and a pentagonal number.
def a (n : ℕ) : ℕ :=
∑ i ∈ range (n + 2), ∑ j ∈ range (n + 2), ∑ k ∈ range (n + 2),
if Nat.triangular i + j ^ 2 + Nat.polygonalNumber 5 k = n then 1 else 0@[category test, AMS 11]
theorem a_0 : a 0 = 1 := ⊢ a 0 = 1
All goals completed! 🐙@[category test, AMS 11]
theorem a_1 : a 1 = 3 := ⊢ a 1 = 3
All goals completed! 🐙@[category test, AMS 11]
theorem a_2 : a 2 = 3 := ⊢ a 2 = 3
All goals completed! 🐙@[category test, AMS 11]
theorem a_3 : a 3 = 2 := ⊢ a 3 = 2
All goals completed! 🐙@[category test, AMS 11]
theorem a_4 : a 4 = 3 := ⊢ a 4 = 3
All goals completed! 🐙It is conjectured that $a(n)$ is always positive (Conjecture 1.1 of Sun (2009)).
@[category research open, AMS 11]
theorem conjecture (n : ℕ) : 0 < a n := n:ℕ⊢ 0 < a n
All goals completed! 🐙end OeisA240088