login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A368372
a(n) = numerator of AM(n)-HM(n), where AM(n) and HM(n) are the arithmetic and harmonic means of the first n positive integers.
3
0, 1, 4, 29, 111, 103, 472, 2369, 12965, 30791, 197346, 452993, 3337271, 7485915, 4160656, 18358463, 170991927, 124184839, 1278605110, 110351535, 98802055, 211524139, 2595194516, 16562041459, 219589922071, 464651871609, 2207044831642, 4649180818987, 70862100349605, 148699793966557
OFFSET
1,3
EXAMPLE
0, 1/6, 4/11, 29/50, 111/137, 103/98, 472/363, 2369/1522, 12965/7129, 30791/14762, 197346/83711, 452993/172042, 3337271/1145993, 7485915/2343466, 4160656/1195757, 18358463/4873118, ...
MAPLE
AM:=proc(n) local i; (add(i, i=1..n)/n); end;
HM:=proc(n) local i; (add(1/i, i=1..n)/n)^(-1); end;
s1:=[seq(AM(n)-HM(n), n=1..50)];
MATHEMATICA
A368372[n_] := Numerator[(n+1)/2 - n/HarmonicNumber[n]];
Array[A368372, 35] (* Paolo Xausa, Jan 29 2024 *)
PROG
(Python)
from fractions import Fraction
from itertools import count, islice
def agen(): # generator of terms
A = H = 0
for n in count(1):
A += n
H += Fraction(1, n)
yield ((A*Fraction(1, n) - n/H)).numerator
print(list(islice(agen(), 30))) # Michael S. Branicky, Jan 24 2024
(Python)
from fractions import Fraction
from sympy import harmonic
def A368372(n): return (Fraction(n+1, 2)-Fraction(n, harmonic(n))).numerator # Chai Wah Wu, Jan 25 2024
(PARI) a368372(n) = numerator((n+1)/2 - n/harmonic(n)) \\ Hugo Pfoertner, Jan 25 2024
CROSSREFS
KEYWORD
nonn,frac
AUTHOR
N. J. A. Sloane, Jan 24 2024
STATUS
approved