cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A078147 First differences of sequence of nonsquarefree numbers, A013929.

Original entry on oeis.org

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

Views

Author

Labos Elemer, Nov 26 2002

Keywords

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

Examples

			a(1) = 4 = 8 - 4.
		

Crossrefs

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) = 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

Extensions

Offset fixed by Reinhard Zumkeller, Apr 22 2012