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.

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.

This page as a plain text file.
%I A286471 #12 May 12 2017 18:21:01
%S A286471 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,
%T A286471 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,
%U A286471 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
%N 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.
%H A286471 Antti Karttunen, <a href="/A286471/b286471.txt">Table of n, a(n) for n = 1..10000</a>
%F A286471 If n is noncomposite, then a(n) = 0, otherwise a(n) = 1 + A055396(A032742(n)) - A055396(n).
%e A286471 For n = 1, 2 and 3, which are all noncomposite numbers, a(n) = 0.
%e A286471 For n = 4 = 2*2 = prime(1)*prime(1), the difference 1-1 = 0, plus one is 1, thus a(4) = 1.
%e A286471 For n = 6 = 2*3 = prime(1)*prime(2), the difference 2-1 = 1, plus one is 2, thus a(6) = 2.
%t A286471 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 *)
%o A286471 (Scheme) (define (A286471 n) (if (or (= 1 n) (= 1 (A001222 n))) 0 (+ 1 (- (A055396 (A032742 n)) (A055396 n)))))
%o A286471 (Python)
%o A286471 from sympy import primepi, isprime, primefactors, divisors
%o A286471 def a049084(n): return primepi(n)*(1*isprime(n))
%o A286471 def a055396(n): return 0 if n==1 else a049084(min(primefactors(n)))
%o A286471 def a(n): return 0 if n==1 or isprime(n) else 1 + a055396(divisors(n)[-2]) - a055396(n) # _Indranil Ghosh_, May 12 2017
%Y A286471 Cf. A001222, A032742, A055396.
%Y A286471 Cf. also A241917, A241919, A242411, A243055, A243056, A286472.
%K A286471 nonn
%O A286471 1,6
%A A286471 _Antti Karttunen_, May 11 2017