OFFSET
1,2
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..100000
L. Marmet, First occurrences of square-free gaps and an algorithm for their computation, arXiv preprint arXiv:1210.3829 [math.NT], 2012. - From N. J. A. Sloane, Jan 01
FORMULA
a(n) = sum{k=0..n-1, moebius_mu(n-k-1) mod 2}.
From Antti Karttunen, Oct 07 2016: (Start)
a(n) = 1 + A013928(n). [Cf. Charles R Greathouse IV's PARI-program.]
For all n >= 1, a(A005117(n)) = n.
(End)
MATHEMATICA
a[n_] := Sum[Boole[SquareFreeQ[k]], {k, 1, n-1}] + 1;
Array[a, 100] (* Jean-François Alcover, Sep 11 2018, from A013928 *)
PROG
(PARI) A107079(n)=1+sum(k=1, n-1, bitand(moebius(k), 1)) \\ Charles R Greathouse IV, Sep 22 2008
(Python)
from math import isqrt
from sympy import mobius
def A107079(n): return 1+sum(mobius(k)*((n-1)//k**2) for k in range(1, isqrt(n-1)+1)) # Chai Wah Wu, Jan 03 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul Barry, May 10 2005
EXTENSIONS
New definition from Charles R Greathouse IV, Sep 22 2008
STATUS
approved