OFFSET
2,2
COMMENTS
a(n) = |{(x,y) : 1 <= x <= y <= n, x + y <= n, 1 = gcd(x,y)}| = |{(x,y) : 1 <= x <= y <= n, x + y > n, 1 = gcd(x,y)}|. - Steve Butler, Mar 31 2006
Brousseau proved that if the starting numbers of a generalized Fibonacci sequence are <= n (for n > 1) then the number of such sequences with relatively prime successive terms is a(n). - Amiram Eldar, Mar 31 2017
LINKS
Giovanni Resta, Table of n, a(n) for n = 2..10000
Alfred Brousseau, A Note on the Number of Fibonacci Sequences, The Fibonacci Quarterly, Vol. 10, No. 6 (1972), pp. 657-658.
FORMULA
a(n) = 1/2 + Sum_{i<j<=n, gcd(i, j) = 1} i/j. - Joseph Wheat, Feb 22 2018
MAPLE
a:=n->sum(numtheory[phi](k), k=1..n): seq(a(n)/2, n=2..60); # Muniru A Asiru, Mar 05 2018
MATHEMATICA
Rest@ Accumulate[EulerPhi@ Range@ 56]/2 (* Michael De Vlieger, Apr 02 2017 *)
PROG
(PARI) a(n) = sum(k=1, n, eulerphi(k))/2; \\ Michel Marcus, Apr 01 2017
(GAP) List([2..60], n->Sum([1..n], k->Phi(k)/2)); # Muniru A Asiru, Mar 05 2018
(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)*(4*A046657(k1)-1)
j, k1 = j2, n//j2
return (n*(n-1)-c+j)//4 # Chai Wah Wu, Mar 25 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved