login

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”).

A078147
First differences of sequence of nonsquarefree numbers, A013929.
97
4, 1, 3, 4, 2, 2, 4, 1, 2, 1, 4, 4, 4, 4, 1, 3, 1, 1, 2, 2, 2, 4, 3, 1, 4, 4, 3, 1, 4, 1, 3, 4, 2, 2, 4, 2, 1, 1, 4, 4, 4, 4, 1, 3, 1, 3, 1, 1, 2, 4, 3, 1, 4, 4, 3, 1, 2, 2, 1, 3, 4, 2, 2, 4, 1, 2, 1, 3, 1, 4, 4, 4, 1, 3, 4, 2, 2, 4, 3, 1, 4, 4, 4, 4, 1, 3, 4, 2, 2, 4, 2, 1, 1, 1, 3, 2, 2, 4, 4, 1, 3, 4, 2, 2, 3
OFFSET
1,1
COMMENTS
Run lengths in A132345, apart from initial run of zeros. - Reinhard Zumkeller, Apr 22 2012
The asymptotic density of the occurrences of 1 in this sequence is density(A068781)/density(A013929) = (1 - 2 * A059956 + A065474)/A229099 = 0.272347... - Amiram Eldar, Mar 09 2021
LINKS
FORMULA
a(n) = A013929(n+1) - A013929(n).
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