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.

A286470 a(n) = maximal gap between indices of successive primes in the prime factorization of n.

This page as a plain text file.
%I A286470 #19 May 20 2017 21:56:14
%S A286470 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,1,0,0,3,6,
%T A286470 1,1,0,7,4,2,0,2,0,4,1,8,0,1,0,2,5,5,0,1,2,3,6,9,0,1,0,10,2,0,3,3,0,6,
%U A286470 7,2,0,1,0,11,1,7,1,4,0,2,0,12,0,2,4,13,8,4,0,1,2,8,9,14,5,1,0,3,3,2,0,5,0,5,1,15,0,1,0,2,10,3,0,6,6,9,4,16,3,1
%N A286470 a(n) = maximal gap between indices of successive primes in the prime factorization of n.
%H A286470 Antti Karttunen, <a href="/A286470/b286470.txt">Table of n, a(n) for n = 1..10000</a>
%F A286470 a(1) = 0, for n > 1, if A001221(n) = 1 [when n is a prime power], a(n) = 0, otherwise a(n) = max((A055396(A032742(n))-A055396(n)), a(A032742(n))).
%F A286470 For all n >= 1, a(n) <= A243055(n).
%e A286470 For n = 70 = 2*5*7 = prime(1)*prime(3)*prime(4), the largest index difference occurs between prime(1) and prime(3), thus a(70) = 3-1 = 2.
%t A286470 Table[If[Or[n == 1, PrimeNu@ n == 1], 0, Max@ Differences@ PrimePi[FactorInteger[n][[All, 1]]]], {n, 120}] (* _Michael De Vlieger_, May 16 2017 *)
%o A286470 (Scheme) (define (A286470 n) (cond ((or (= 1 n) (= 1 (A001221 n))) 0) (else (max (- (A055396 (A032742 n)) (A055396 n)) (A286470 (A032742 n))))))
%o A286470 (Python)
%o A286470 from sympy import primepi, isprime, primefactors, divisors
%o A286470 def a049084(n): return primepi(n)*(1*isprime(n))
%o A286470 def a055396(n): return 0 if n==1 else a049084(min(primefactors(n)))
%o A286470 def x(n): return 1 if n==1 else divisors(n)[-2]
%o A286470 def a(n): return 0 if n==1 or len(primefactors(n))==1 else max(a055396(x(n)) - a055396(n), a(x(n))) # _Indranil Ghosh_, May 17 2017
%Y A286470 Cf. A001221, A032742, A055396, A073490, A243055, A286455, A286471, A286472.
%Y A286470 Cf. A286469 (version which considers the index of the smallest prime as the initial gap).
%Y A286470 Cf. A000961 (positions of zeros).
%Y A286470 Differs from A242411 for the first time at n=70, where a(70) = 2, while A242411(70) = 1.
%K A286470 nonn
%O A286470 1,10
%A A286470 _Antti Karttunen_, May 13 2017
%E A286470 Definition corrected by _Zak Seidov_, May 16 2017