A078147 First differences of sequence of nonsquarefree numbers, A013929.
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
Examples
a(1) = 4 = 8 - 4.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Programs
-
Haskell
a078147 n = a078147_list !! (n-1) a078147_list = zipWith (-) (tail a013929_list) a013929_list -- Reinhard Zumkeller, Apr 22 2012
-
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 *)
-
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
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
Extensions
Offset fixed by Reinhard Zumkeller, Apr 22 2012
Comments