A243055 Difference between the indices of the smallest and the largest prime dividing n: If n = p_i * ... * p_k, where p_i <= ... <= p_k, where p_h = A000040(h), then a(n) = (k-i), a(1) = 0 by convention.
0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 1, 0, 3, 1, 0, 0, 1, 0, 2, 2, 4, 0, 1, 0, 5, 0, 3, 0, 2, 0, 0, 3, 6, 1, 1, 0, 7, 4, 2, 0, 3, 0, 4, 1, 8, 0, 1, 0, 2, 5, 5, 0, 1, 2, 3, 6, 9, 0, 2, 0, 10, 2, 0, 3, 4, 0, 6, 7, 3, 0, 1, 0, 11, 1, 7, 1, 5, 0, 2, 0, 12, 0, 3, 4, 13, 8, 4, 0, 2
Offset: 1
Keywords
Links
Crossrefs
Programs
-
Maple
with(numtheory): a:= n-> `if`(n=1, 0, (f-> pi(max(f[]))-pi(min(f[])))(factorset(n))): seq(a(n), n=1..100); # Alois P. Heinz, Jun 04 2015
-
Mathematica
a[1]=0; a[n_] := Function[{f}, PrimePi[Max[f]] - PrimePi[Min[f]]][FactorInteger[n][[All, 1]]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jul 29 2015, after Alois P. Heinz *)
-
Python
from sympy import primepi, primefactors def A243055(n): return primepi(max(p:=primefactors(n),default=0))-primepi(min(p,default=0)) # Chai Wah Wu, Oct 10 2023
-
Scheme
(define (A243055 n) (- (A061395 n) (A055396 n)))
Comments