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

First differences of sequence of nonsquarefree numbers, A013929.
97

%I #36 Sep 10 2024 14:22:19

%S 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,

%T 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,

%U 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

%N First differences of sequence of nonsquarefree numbers, A013929.

%C Run lengths in A132345, apart from initial run of zeros. - _Reinhard Zumkeller_, Apr 22 2012

%C 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

%H Reinhard Zumkeller, <a href="/A078147/b078147.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A013929(n+1) - A013929(n).

%F a(n) = 1, 2, 3 or 4 since n = 4*k is always nonsquarefree.

%F 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

%e a(1) = 4 = 8 - 4.

%t t=Flatten[Position[Table[MoebiusMu[w], {w, 1, 1000}], 0]]; t1=Delete[RotateLeft[t]-t, -1]

%t Differences[Select[Range[300],!SquareFreeQ[#]&]] (* _Harvey P. Dale_, May 07 2012 *)

%o (Haskell)

%o a078147 n = a078147_list !! (n-1)

%o a078147_list = zipWith (-) (tail a013929_list) a013929_list

%o -- _Reinhard Zumkeller_, Apr 22 2012

%o (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

%o (Python)

%o from math import isqrt

%o from sympy import mobius, factorint

%o def A078147(n):

%o def f(x): return n+sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1))

%o m, k = n, f(n)

%o while m != k: m, k = k, f(k)

%o 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

%Y Cf. A068781, A013929, A132345.

%Y Cf. A059956, A065474, A229099.

%K easy,nonn

%O 1,1

%A _Labos Elemer_, Nov 26 2002

%E Offset fixed by _Reinhard Zumkeller_, Apr 22 2012