login
A241917
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)).
16
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, 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, 0, 3, 3, 19, 6, 7, 1, 20, 0, 21, 11, 0, 7, 1, 4, 22, 2, 0, 12, 23
OFFSET
1,3
COMMENTS
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.
FORMULA
a(n) = A061395(n) - A061395(A052126(n)).
PROG
(Scheme) (define (A241917 n) (- (A061395 n) (A061395 (A052126 n))))
(Haskell)
a241917 n = i - j where
(i:j:_) = map a049084 $ reverse (1 : a027746_row n)
-- Reinhard Zumkeller, May 15 2014
(Python)
from sympy import primefactors, primepi
def a061395(n): return 0 if n==1 else primepi(primefactors(n)[-1])
def a052126(n): return 1 if n==1 else n/primefactors(n)[-1]
def a(n): return 0 if n==1 else a061395(n) - a061395(a052126(n)) # Indranil Ghosh, May 19 2017
(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
CROSSREFS
Cf. A241919, A242411, A243055 for other variants.
Sequence in context: A355528 A277697 A355525 * A355526 A243056 A338568
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 13 2014
STATUS
approved