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.

A076998 Difference between cubefree and squarefree components of n.

Original entry on oeis.org

0, 0, 0, 2, 0, 0, 0, 2, 6, 0, 0, 6, 0, 0, 0, 2, 0, 12, 0, 10, 0, 0, 0, 6, 20, 0, 6, 14, 0, 0, 0, 2, 0, 0, 0, 30, 0, 0, 0, 10, 0, 0, 0, 22, 30, 0, 0, 6, 42, 40, 0, 26, 0, 12, 0, 14, 0, 0, 0, 30, 0, 0, 42, 2, 0, 0, 0, 34, 0, 0, 0, 30, 0, 0, 60, 38, 0, 0, 0, 10, 6, 0, 0, 42, 0, 0, 0, 22, 0, 60, 0, 46
Offset: 1

Views

Author

Jon Perry, Nov 28 2002

Keywords

Examples

			a(4)=2 as cubefree(4)=4 and squarefree(4)=2. 4-2=2
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{f = FactorInteger[n]}, Times @@ (First[#]^Min[Last[#], 2] & /@ f) - Times @@ (First[#] & /@ f)]; Array[a, 100] (* Amiram Eldar, Sep 24 2023 *)
  • PARI
    rad(n)=local(p,i); p=factor(n)[,1]; prod(i=1,length(p),p[i])
    rad2(n)=local(p,pn,i); p=factor(n)[,1]; pn=factor(n)[,2]; prod(i=1,length(p),p[i]^min(2,pn[i]))
    for (k=1,100,print1(rad2(k)-rad(k)", "))
    
  • PARI
    a(n) = {my(f = factor(n)); prod(i = 1, #f~, f[i,1]^min(f[i,2],2)) - vecprod(f[,1]);} \\ Amiram Eldar, Sep 24 2023

Formula

a(n) = A007948(n) - A007947(n). - Antti Karttunen, Jul 21 2018
From Amiram Eldar, Sep 24 2023: (Start)
a(n) >= 0, with equality if and only if n is squarefree (A005117).
Sum_{k=1..n} a(k) ~ (1/2) * c * n^2, where c = A065465 - A065463 = 0.17707163872600518419... . (End)