proposed
approved
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”).
proposed
approved
editing
proposed
return (n*(n-1)-c+j)//4 # Chai Wah Wu, Mar 25 2021
(Python)
from functools import lru_cache
@lru_cache(maxsize=None)
def A046657(n): # based on second formula in A018805
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
approved
editing
reviewed
approved
proposed
reviewed
editing
proposed
(GAP) List([12..60], n->Sum([1..n], k->Phi(k)/2)); # Muniru A Asiru, Mar 05 2018
a:=n->sum(numtheory[phi](k), k=1..n): seq(a(n)/2, n=2..60); # Muniru A Asiru, Mar 05 2018
(GAP) List([1..60], n->Sum([1..n], k->Phi(k)/2)); # Muniru A Asiru, Mar 05 2018
proposed
editing
editing
proposed