OFFSET
1,7
COMMENTS
Conjecture: a(n) ~ (1-EulerGamma)n.
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = floor(n*H(n)) - Sum_{j=1..n} d(j), where d(n)=A000005(n) is the number of divisors of n, and H(n) is the n-th Harmonic Number. [Enrique Pérez Herrero, Aug 25 2009; corrected by Robert Israel, Mar 20 2016]
EXAMPLE
a(5) = [{5/1}+{5/2}+{5/3}+{5/4}+{5/5}]=[0+0.5+0.6666+0.25+0]=[1.4166]=1 (division by 1 or by the number itself is to be avoided).
MAPLE
N:= 100:
H:= ListTools:-PartialSums([seq(1/n, n=1..N)]):
S:= ListTools:-PartialSums(map(numtheory:-tau, [$1..N])):
seq(floor(n*H[n])-S[n], n=1..N); # Robert Israel, Mar 20 2016
MATHEMATICA
Resto = Function[n, Sum[n/k - Floor[n/k], {k, 2, n - 1}]]; Floor[Map[Resto, Range[1, 1000]]]
Table[Floor[n*HarmonicNumber[n]] - Sum[DivisorSigma[0, k], {k, 1, n}], {n, 1, 200}] (* Enrique Pérez Herrero, Aug 25 2009 *)
Table[Floor[Sum[FractionalPart[n/k], {k, 1, n}]], {n, 1, 200}] (* Enrique Pérez Herrero, Aug 25 2009 *)
PROG
(Python)
from math import isqrt
from sympy import harmonic
def A102722(n): return int(n*harmonic(n))+(s:=isqrt(n))**2-(sum(n//k for k in range(1, s+1))<<1) # Chai Wah Wu, Oct 24 2023
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Carlos Alves, Feb 06 2005
STATUS
approved