A286471 If n is noncomposite, then a(n) = 0, otherwise 1 + difference between indices of the two smallest (not necessarily distinct) prime factors of n.
0, 0, 0, 1, 0, 2, 0, 1, 1, 3, 0, 1, 0, 4, 2, 1, 0, 2, 0, 1, 3, 5, 0, 1, 1, 6, 1, 1, 0, 2, 0, 1, 4, 7, 2, 1, 0, 8, 5, 1, 0, 2, 0, 1, 1, 9, 0, 1, 1, 3, 6, 1, 0, 2, 3, 1, 7, 10, 0, 1, 0, 11, 1, 1, 4, 2, 0, 1, 8, 3, 0, 1, 0, 12, 2, 1, 2, 2, 0, 1, 1, 13, 0, 1, 5, 14, 9, 1, 0, 2, 3, 1, 10, 15, 6, 1, 0, 4, 1, 1, 0, 2, 0, 1, 2, 16, 0, 1, 0, 3, 11, 1, 0, 2, 7, 1, 1, 17
Offset: 1
Keywords
Examples
For n = 1, 2 and 3, which are all noncomposite numbers, a(n) = 0. For n = 4 = 2*2 = prime(1)*prime(1), the difference 1-1 = 0, plus one is 1, thus a(4) = 1. For n = 6 = 2*3 = prime(1)*prime(2), the difference 2-1 = 1, plus one is 2, thus a(6) = 2.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Mathematica
Table[If[Length@ # < 2, 0, First@ Differences@ PrimePi@ Take[#, 2] + 1] &@ Flatten[FactorInteger[n] /. {p_, e_} /; p > 0 :> ConstantArray[p, e]], {n, 118}] (* Michael De Vlieger, May 12 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 a(n): return 0 if n==1 or isprime(n) else 1 + a055396(divisors(n)[-2]) - a055396(n) # Indranil Ghosh, May 12 2017
-
Scheme
(define (A286471 n) (if (or (= 1 n) (= 1 (A001222 n))) 0 (+ 1 (- (A055396 (A032742 n)) (A055396 n)))))