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

Floor of sum of ${n/k}$

Given $n$, sum all division remainders ${n/k}$, with $k=1,\dots,n$. The value $a(n)$ is given by the floor of that sum. Note that ${x}:=x-[x]$. Conjecture: a(n) ~ (1-EulerGamma)n.

References:

namespace OeisA102722open BigOperators Finset Int Asymptotics Filter

The primary defining sequence a. a n is the floor of the sum of all division remainders ${n/k}$, with $k=1,\dots,n$. $$a(n) = \left\lfloor \sum_{k=1}^n \left{ \frac{n}{k} \right} \right\rfloor$$

noncomputable def a (n : ) : := let sumOfFractParts : := (Icc 1 n).sum fun k : => -- Int.fract is the fractional part function {x}. fract ((n : ) / (k : )) (floor sumOfFractParts).toNatAll goals completed! 🐙All goals completed! 🐙All goals completed! 🐙f: h:Icc 1 4 = {1, 2, 3, 4}f 1 + (f 2 + (f 3 + f 4)) = f 1 + f 2 + f 3 + f 4 All goals completed! 🐙f: h:Icc 1 5 = {1, 2, 3, 4, 5}f 1 + (f 2 + (f 3 + (f 4 + f 5))) = f 1 + f 2 + f 3 + f 4 + f 5 All goals completed! 🐙macro "eval_a" : tactic => `(tactic| ( delta a simp only [a_sum_1, a_sum_2, a_sum_3, a_sum_4, a_sum_5] norm_num ))

Term theorems verifying the first few values of the sequence against the official OEIS b-file

@[category test, AMS 11] theorem a_1 : a 1 = 0 := a 1 = 0 All goals completed! 🐙@[category test, AMS 11] theorem a_2 : a 2 = 0 := a 2 = 0 All goals completed! 🐙@[category test, AMS 11] theorem a_3 : a 3 = 0 := a 3 = 0 All goals completed! 🐙@[category test, AMS 11] theorem a_4 : a 4 = 0 := a 4 = 0 All goals completed! 🐙@[category test, AMS 11] theorem a_5 : a 5 = 1 := a 5 = 1 All goals completed! 🐙

A102722 Conjecture: $a(n) \sim (1-\gamma)n$.

@[category research solved, AMS 11, formal_proof using lean4 at "https://github.com/KitaKen1/oeis-102722-asymptotic/blob/0e3bf1bc6dfd04627f926b07fb8d25f4395a5072/lean/OEIS102722FC.lean#L18-L24"] theorem conjecture : (fun n : => (a n : )) ~[atTop] (fun n : => (1 - Real.eulerMascheroniConstant) * (n : )) := (fun n (a n)) ~[atTop] fun n (1 - Real.eulerMascheroniConstant) * n All goals completed! 🐙end OeisA102722