OFFSET
1,1
COMMENTS
Run lengths in A132345, apart from initial run of zeros. - Reinhard Zumkeller, Apr 22 2012
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = 1, 2, 3 or 4 since n = 4*k is always nonsquarefree.
Asymptotic mean: lim_{n->oo} (1/n) Sum_{k=1..n} a(k) = Pi^2/(Pi^2-6) = 2.550546... - Amiram Eldar, Oct 21 2020
EXAMPLE
a(1) = 4 = 8 - 4.
MATHEMATICA
t=Flatten[Position[Table[MoebiusMu[w], {w, 1, 1000}], 0]]; t1=Delete[RotateLeft[t]-t, -1]
Differences[Select[Range[300], !SquareFreeQ[#]&]] (* Harvey P. Dale, May 07 2012 *)
PROG
(Haskell)
a078147 n = a078147_list !! (n-1)
a078147_list = zipWith (-) (tail a013929_list) a013929_list
-- Reinhard Zumkeller, Apr 22 2012
(PARI) lista(nn) = {my(prec=0); for (n=1, nn, if (!issquarefree(n), if (prec, print1(n-prec, ", ")); prec = n; ); ); } \\ Michel Marcus, Mar 26 2020
(Python)
from math import isqrt
from sympy import mobius, factorint
def A078147(n):
def f(x): return n+sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1))
m, k = n, f(n)
while m != k: m, k = k, f(k)
return next(i for i in range(1, 5) if any(d>1 for d in factorint(m+i).values())) # Chai Wah Wu, Sep 10 2024
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Labos Elemer, Nov 26 2002
EXTENSIONS
Offset fixed by Reinhard Zumkeller, Apr 22 2012
STATUS
approved