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.

Showing 1-3 of 3 results.

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

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Antti Karttunen, May 13 2017

Keywords

Examples

			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.
		

Crossrefs

Cf. A286469 (version which considers the index of the smallest prime as the initial gap).
Cf. A000961 (positions of zeros).
Differs from A242411 for the first time at n=70, where a(70) = 2, while A242411(70) = 1.

Programs

  • Mathematica
    Table[If[Or[n == 1, PrimeNu@ n == 1], 0, Max@ Differences@ PrimePi[FactorInteger[n][[All, 1]]]], {n, 120}] (* Michael De Vlieger, May 16 2017 *)
  • Python
    from sympy import primepi, isprime, primefactors, divisors
    def a049084(n): return primepi(n)*(1*isprime(n))
    def a055396(n): return 0 if n==1 else a049084(min(primefactors(n)))
    def x(n): return 1 if n==1 else divisors(n)[-2]
    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
  • Scheme
    (define (A286470 n) (cond ((or (= 1 n) (= 1 (A001221 n))) 0) (else (max (- (A055396 (A032742 n)) (A055396 n)) (A286470 (A032742 n))))))
    

Formula

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))).
For all n >= 1, a(n) <= A243055(n).

Extensions

Definition corrected by Zak Seidov, May 16 2017

A286472 Compound filter (for counting prime gaps): a(1) = 1, a(n) = 2*A032742(n) + (1 if n is composite and spf(A032742(n)) > nextprime(spf(n)), and 0 otherwise). Here spf is the smallest prime factor, A020639.

Original entry on oeis.org

1, 2, 2, 4, 2, 6, 2, 8, 6, 11, 2, 12, 2, 15, 10, 16, 2, 18, 2, 20, 15, 23, 2, 24, 10, 27, 18, 28, 2, 30, 2, 32, 23, 35, 14, 36, 2, 39, 27, 40, 2, 42, 2, 44, 30, 47, 2, 48, 14, 51, 35, 52, 2, 54, 23, 56, 39, 59, 2, 60, 2, 63, 42, 64, 27, 66, 2, 68, 47, 71, 2, 72, 2, 75, 50, 76, 22, 78, 2
Offset: 1

Views

Author

Antti Karttunen, May 11 2017

Keywords

Comments

For n > 1, a(n) is odd if and only if n is a composite with its smallest prime factor occurring only once and with a gap of at least one between the smallest and the next smallest prime factor.
For all i, j: a(i) = a(j) => A073490(i) = A073490(j). This follows because A073490(n) can be computed by recursively invoking a(n), without needing any other information.

Examples

			For n = 4 = 2*2, the two smallest prime factors (taken with multiplicity) are 2 and 2, and the difference between their indices is 0, thus a(4) = 2*A032742(4) + 0 = 2*(4/2) + 0 = 2.
For n = 6 = 2*3 = prime(1)*prime(2), the difference between the indices of two smallest prime factors is 1 (which is less than required 2), thus a(6) = 2*A032742(6) + 0 = 2*(6/2) + 0 = 6.
For n = 10 = 2*5 = prime(1)*prime(3), the difference between the indices of two smallest prime factors is 2, thus a(10) = 2*A032742(10) + 1 = 2*(10/2) + 1 = 11.
		

Crossrefs

Cf. A000040 (primes give the positions of 2's).
Cf. A073490 (one of the matched sequences).

Programs

  • Mathematica
    Table[Function[{p, d}, 2 d + If[And[CompositeQ@ n, FactorInteger[d][[1, 1]] > NextPrime[p]], 1, 0] - Boole[n == 1]] @@ {#, n/#} &@ FactorInteger[n][[1, 1]], {n, 98}] (* Michael De Vlieger, May 12 2017 *)
  • Python
    from sympy import primefactors, divisors, nextprime
    def ok(n): return 1 if isprime(n)==0 and min(primefactors(divisors(n)[-2])) > nextprime(min(primefactors(n))) else 0
    def a(n): return 1 if n==1 else 2*divisors(n)[-2] + ok(n) # Indranil Ghosh, May 12 2017
  • Scheme
    (define (A286472 n) (if (= 1 n) n (+ (* 2 (A032742 n)) (if (> (A286471 n) 2) 1 0))))
    

Formula

a(n) = 2*A032742(n) + [A286471(n) > 2], a(1) = 1.

A297173 Smallest difference between indices of prime divisors of n, or 0 if n is a prime power.

Original entry on oeis.org

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, 1, 1, 0, 7, 4, 2, 0, 1, 0, 4, 1, 8, 0, 1, 0, 2, 5, 5, 0, 1, 2, 3, 6, 9, 0, 1, 0, 10, 2, 0, 3, 1, 0, 6, 7, 1, 0, 1, 0, 11, 1, 7, 1, 1, 0, 2, 0, 12, 0, 1, 4, 13, 8, 4, 0, 1, 2, 8, 9, 14, 5, 1, 0, 3, 3, 2, 0, 1, 0, 5, 1
Offset: 1

Views

Author

Antti Karttunen, Mar 03 2018

Keywords

Examples

			For n = 130 = 2*5*13 = prime(1)*prime(3)*prime(6), the smallest difference between indices is 3-1 = 2, thus a(130) = 2.
		

Crossrefs

Programs

  • PARI
    A297173(n) = if(omega(n)<=1,0,my(ps=factor(n)[,1]); vecmin(vector((#ps)-1,i,primepi(ps[i+1])-primepi(ps[i]))));

Formula

a(A073491(n)) <= 1.
Showing 1-3 of 3 results.