%I #31 Jul 10 2024 09:36:35
%S 0,1,2,0,3,1,4,0,0,2,5,1,6,3,1,0,7,0,8,2,2,4,9,1,0,5,0,3,10,1,11,0,3,
%T 6,1,0,12,7,4,2,13,2,14,4,1,8,15,1,0,0,5,5,16,0,2,3,6,9,17,1,18,10,2,
%U 0,3,3,19,6,7,1,20,0,21,11,0,7,1,4,22,2,0,12,23
%N If n is a prime with index i, p_i, a(n) = i, (with a(1)=0), otherwise difference (i-j) of the indices of the two largest primes p_i, p_j, i >= j in the prime factorization of n: a(n) = A061395(n) - A061395(A052126(n)).
%C Note: the two largest primes in the multiset of prime divisors of n are equal for all numbers that are in A070003, thus, after a(1)=0, A070003 gives the positions of the other zeros in this sequence.
%H Antti Karttunen, <a href="/A241917/b241917.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Pri#prime_indices">Index entries for sequences related to prime indices in the factorization of n</a>
%F a(n) = A061395(n) - A061395(A052126(n)).
%o (Scheme) (define (A241917 n) (- (A061395 n) (A061395 (A052126 n))))
%o (Haskell)
%o a241917 n = i - j where
%o (i:j:_) = map a049084 $ reverse (1 : a027746_row n)
%o -- _Reinhard Zumkeller_, May 15 2014
%o (Python)
%o from sympy import primefactors, primepi
%o def a061395(n): return 0 if n==1 else primepi(primefactors(n)[-1])
%o def a052126(n): return 1 if n==1 else n/primefactors(n)[-1]
%o def a(n): return 0 if n==1 else a061395(n) - a061395(a052126(n)) # _Indranil Ghosh_, May 19 2017
%o (PARI) A241917(n) = if(isprime(n), primepi(n), if(1>=omega(n), 0, my(f=factor(n)); if(f[#f~,2]>1, 0, primepi(f[#f~,1])-primepi(f[(#f~)-1,1])))); \\ _Antti Karttunen_, Jul 10 2024
%Y Cf. A052126, A061395, A070003, A122111, A241909.
%Y Cf. A049084, A027746.
%Y Cf. A241919, A242411, A243055 for other variants.
%K nonn
%O 1,3
%A _Antti Karttunen_, May 13 2014