/-
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.
-/importFormalConjecturesUtil
Representation of sequence terms by harmonic numbers $\lfloor \frac{1}{2H(n) - H(n^2+n-1) - \gamma} \rfloor$
A227582: Expansion of $(2+3x+2x^2+2x^3+3x^4+x^5-x^6)/(1-2x+x^2-x^5+2x^6-x^7)$.
The sequence $b_n$ such that $A227582(n) = b_{n-1}$ for $n \ge 1$.
This is the 0-indexed solution to the linear recurrence in $\mathbb{Z}$.
defbaseSeq(n:ℕ):ℤ:=letorder:=7-- Coefficients $c_i$ for the recurrence $u_{n+7} = \sum_{i=0}^6 c_i u_{n+i}$.-- This corresponds to the OEIS signature $(2, -1, 0, 0, 1, -2, 1)$ which means $c_i = s_{7-i}$.letcoeffs:Finorder→ℤ:=![1,-2,1,0,0,-1,2]-- Initial values $a_zero$ through $a_6$. These are {2, 7, 14, 23, 35, 50, 67}.letinit:Finorder→ℤ:=![2,7,14,23,35,50,67]letE:LinearRecurrenceℤ:={order:=order,coeffs:=coeffs}E.mkSolinitn
Expansion of $(2+3x+2x^2+2x^3+3x^4+x^5-x^6)/(1-2x+x^2-x^5+2x^6-x^7)$, 1-indexed.
The linear recurrence:
$$b(n + 7) = 2 b(n + 6) - b(n + 5) + b(n + 2) - 2 b(n + 1) + b(n)$$
holds for baseSeq. This follows directly from LinearRecurrence.is_sol_mkSol.
n:ℕE:LinearRecurrenceℤ:={order:=7,coeffs:=![1,-2,1,0,0,-1,2]}init:Fin7→ℤ:=![2,7,14,23,35,50,67]h:E.mkSolinit(n+E.order)=∑i,E.coeffsi*E.mkSolinit(n+↑i)⊢ ∑i,E.coeffsi*E.mkSolinit(n+↑i)=2*E.mkSolinit(n+6)-E.mkSolinit(n+5)+E.mkSolinit(n+2)-2*E.mkSolinit(n+1)+E.mkSolinitn-- Expand the sum and reduce all coefficient lookupssimponly[Fin.sum_univ_seven,E,Fin.isValue]n:ℕE:LinearRecurrenceℤ:={order:=7,coeffs:=![1,-2,1,0,0,-1,2]}init:Fin7→ℤ:=![2,7,14,23,35,50,67]h:E.mkSolinit(n+E.order)=∑i,E.coeffsi*E.mkSolinit(n+↑i)⊢ ![1,-2,1,0,0,-1,2]0*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+↑0)+![1,-2,1,0,0,-1,2]1*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+↑1)+![1,-2,1,0,0,-1,2]2*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+↑2)+![1,-2,1,0,0,-1,2]3*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+↑3)+![1,-2,1,0,0,-1,2]4*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+↑4)+![1,-2,1,0,0,-1,2]5*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+↑5)+![1,-2,1,0,0,-1,2]6*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+↑6)=2*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+6)-{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+5)+{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+2)-2*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+1)+{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinitn-- Reduce matrix lookups: ![1, -2, 1, 0, 0, -1, 2] i for all i : Fin 7-- and Fin coercions: ↑(i : Fin 7) for each inorm_num[show(![1,-2,1,0,0,-1,2]:Fin7→ℤ)0=1fromrfl,show(![1,-2,1,0,0,-1,2]:Fin7→ℤ)1=-2fromrfl,show(![1,-2,1,0,0,-1,2]:Fin7→ℤ)2=1fromrfl,show(![1,-2,1,0,0,-1,2]:Fin7→ℤ)3=0fromrfl,show(![1,-2,1,0,0,-1,2]:Fin7→ℤ)4=0fromrfl,show(![1,-2,1,0,0,-1,2]:Fin7→ℤ)5=-1fromrfl,show(![1,-2,1,0,0,-1,2]:Fin7→ℤ)6=2fromrfl]n:ℕE:LinearRecurrenceℤ:={order:=7,coeffs:=![1,-2,1,0,0,-1,2]}init:Fin7→ℤ:=![2,7,14,23,35,50,67]h:E.mkSolinit(n+E.order)=∑i,E.coeffsi*E.mkSolinit(n+↑i)⊢ {order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinitn+-(2*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+1))+{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+2)+-{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+5)+2*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+6)=2*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+6)-{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+5)+{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+2)-2*{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinit(n+1)+{order:=7,coeffs:=![1,-2,1,0,0,-1,2]}.mkSolinitnringAll goals completed! 🐙
Conjecture (from A227581): $a(n) = \lfloor 1/(2 H(n) - H(n^2 + n - 1) - \gamma) \rfloor$,
where $H$ denotes harmonic numbers and $\gamma$ denotes the Euler-Mascheroni constant.
A formal proof has been found with the methods described in
arxiv/2605.22763.