%I #24 Oct 11 2023 03:56:49
%S 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,
%T 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,
%U 7,3,0,1,0,11,1,7,1,5,0,2,0,12,0,3,4,13,8,4,0,2
%N 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.
%C For n>=1, A100484(n+1) gives the position where n occurs for the first time (setting also the records for the sequence).
%C a(n) = the difference between the largest and the smallest parts of the partition having Heinz number n. We define the Heinz number of a partition p = [p_1, p_2, ..., p_r] as Product(p_j-th prime, j=1...r) (concept used by _Alois P. Heinz_ in A215366 as an "encoding" of a partition). For example, for the partition [1, 1, 2, 4, 10] we get 2*2*3*7*29 = 2436. Example: a(57) = 6; indeed, the partition having Heinz number 57 = 3*19 is [2, 8]. - _Emeric Deutsch_, Jun 04 2015
%H Antti Karttunen, <a href="/A243055/b243055.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Pri#prime_indices">Index entries for sequences computed from indices in prime factorization</a>
%F If n = p_i * ... * p_k, where p_i <= ... <= p_k are not necessarily distinct primes (sorted into nondescending order) in the prime factorization of n, where p_i = A000040(i), then a(n) = (k-i).
%F a(n) = A061395(n) - A055396(n).
%p with(numtheory):
%p a:= n-> `if`(n=1, 0, (f-> pi(max(f[]))-pi(min(f[])))(factorset(n))):
%p seq(a(n), n=1..100); # _Alois P. Heinz_, Jun 04 2015
%t 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_ *)
%o (Scheme) (define (A243055 n) (- (A061395 n) (A055396 n)))
%o (Python)
%o from sympy import primepi, primefactors
%o def A243055(n): return primepi(max(p:=primefactors(n),default=0))-primepi(min(p,default=0)) # _Chai Wah Wu_, Oct 10 2023
%Y Differs from A242411 for the first time at n=30.
%Y A000961 gives the positions of zeros.
%Y Cf. A243056, A241917, A241919, A049084, A027748, A055396, A061395, A100484, A215366.
%K nonn
%O 1,10
%A _Antti Karttunen_, May 31 2014