OFFSET
1,2
COMMENTS
Also number of reduced fractions with denominators <= n and values between 1/n and n (inclusive). [Reinhard Zumkeller, Jan 15 2009]
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
FORMULA
Equals row sums of triangle A143269.
a(n) = SUM(SUM(0^(GCD(i,j)-1): 1<=j<=i*n): 1<=i<=n). [Reinhard Zumkeller, Jan 15 2009]
EXAMPLE
a(4) = 24 = n*A002088(n) = 4*6.
a(4) = 24 = sum of row 4 terms of triangle A143269: (4 + 4 + 8 + 8).
a(3) = #{1/3,1/2,2/3,1,4/3,3/2,5/3,2,7/3,5/2,8/3,3} = 12. [Reinhard Zumkeller, Jan 15 2009]
MATHEMATICA
Module[{nn=50, ps}, ps=Accumulate[EulerPhi[Range[nn]]]; Times@@@Thread[{Range[nn], ps}]] (* Harvey P. Dale, Jun 04 2023 *)
PROG
(Python)
from functools import lru_cache
@lru_cache(maxsize=None)
if n == 0:
return 0
c, j = 0, 2
k1 = n//j
while k1 > 1:
j2 = n//k1 + 1
c += (j2-j)*(2*A143270(k1)//k1-1)
j, k1 = j2, n//j2
return n*(n*(n-1)-c+j)//2 # Chai Wah Wu, Mar 25 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Gary W. Adamson, Aug 03 2008
EXTENSIONS
More terms from Reinhard Zumkeller, Jan 15 2009
STATUS
approved