login
Largest prime divisor of n - smallest prime divisor of n (a(1)=0).
18

%I #27 Mar 07 2020 23:33:17

%S 0,0,0,0,0,1,0,0,0,3,0,1,0,5,2,0,0,1,0,3,4,9,0,1,0,11,0,5,0,3,0,0,8,

%T 15,2,1,0,17,10,3,0,5,0,9,2,21,0,1,0,3,14,11,0,1,6,5,16,27,0,3,0,29,4,

%U 0,8,9,0,15,20,5,0,1,0,35,2,17,4,11,0,3,0,39,0,5,12,41,26,9,0

%N Largest prime divisor of n - smallest prime divisor of n (a(1)=0).

%C Even nonzero terms correspond to odd composite numbers that are not powers of primes. Terms of A030173 appear in this sequence infinitely often. - _Alonso del Arte_, Nov 27 2011

%C A135093(n) = first occurrence of A030173(n). - _Reinhard Zumkeller_, Jul 03 2015

%D Handbook of Number Theory, D. S. Mitrinovic et al., Kluwer, Section IV.1.

%H T. D. Noe, <a href="/A046665/b046665.txt">Table of n, a(n) for n = 1..1000</a>

%F a(n) = A006530(n) - A020639(n).

%p a:= n-> `if`(n=1, 0, (s-> max(s)-min(s))(numtheory[factorset](n))):

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Mar 07 2020

%t f[n_]:=Transpose[FactorInteger[n]][[1]];Table[Last[f[n]-First[f[n]]],{n,200}] (* _Vladimir Joseph Stephan Orlovsky_, Apr 08 2011 *)

%t lpd[n_]:=Module[{fi=FactorInteger[n]},fi[[-1,1]]-fi[[1,1]]]; Array[lpd,90] (* _Harvey P. Dale_, Dec 31 2017 *)

%o (Haskell)

%o a046665 n = a006530 n - a020639 n -- _Reinhard Zumkeller_, Jul 03 2015

%o (PARI) a(n)={if(n==1, 0, my(f=factor(n)[,1]); f[#f]-f[1])} \\ _Andrew Howroyd_, Mar 07 2020

%Y Cf. A006530, A020639, A074320, A066048, A130064, A130065.

%K nonn,easy,nice

%O 1,10

%A _N. J. A. Sloane_

%E More terms from _James A. Sellers_