OFFSET
1,3
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Squarefree
FORMULA
G.f.: Sum_{k>=1} x^A056911(k)/(1 - x).
a(n) ~ 4*n/Pi^2. See A185199.
a(n) = Sum_{k=1..n} A008683(2k)^2. - Ridouane Oudra, Aug 16 2019
MAPLE
ListTools:-PartialSums(map(op, [seq(`if`(numtheory:-issqrfree(n), [1, 0], [0, 0]), n=1..100, 2)])); # Robert Israel, May 07 2018
seq(add(mobius(2*k)^2, k=1..n), n=1..100); # Ridouane Oudra, Aug 16 2019
MATHEMATICA
Table[Sum[Boole[OddQ[k] && SquareFreeQ[k]], {k, 1, n}], {n, 85}]
nmax = 85; Rest[CoefficientList[Series[Sum[Boole[OddQ[k] && MoebiusMu[k]^2 == 1] x^k/(1 - x), {k, 1, nmax}], {x, 0, nmax}], x]]
PROG
(PARI) a(n) = sum(k=1, n, (k%2)*issquarefree(k)); \\ Michel Marcus, Apr 27 2017
(Python)
from sympy.ntheory.factor_ import core
def a(n): return sum([1 for k in range(1, n + 1) if k%2==1 and core(k)==k]) # Indranil Ghosh, Apr 28 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Ilya Gutkovskiy, Apr 27 2017
STATUS
approved