login
a(n) = largest prime less than the smallest prime dividing n (or 1 if there is no such prime).
5

%I #15 Sep 16 2017 22:36:57

%S 1,1,2,1,3,1,5,1,2,1,7,1,11,1,2,1,13,1,17,1,2,1,19,1,3,1,2,1,23,1,29,

%T 1,2,1,3,1,31,1,2,1,37,1,41,1,2,1,43,1,5,1,2,1,47,1,3,1,2,1,53,1,59,1,

%U 2,1,3,1,61,1,2,1,67,1,71,1,2,1,5,1,73,1,2,1,79,1,3,1,2,1,83,1,5,1,2,1,3,1

%N a(n) = largest prime less than the smallest prime dividing n (or 1 if there is no such prime).

%C a(n) = 1 if and only if n is even or if n = 1.

%H Michael De Vlieger, <a href="/A117365/b117365.txt">Table of n, a(n) for n = 1..10000</a>

%e 5 is the smallest prime dividing 35. So a(35) is the largest prime < 5, which is 3.

%t a[n_] := If[EvenQ[n], 1, Prime[PrimePi[FactorInteger[n][[1]][[1]]] - 1]]; Table[a[n], {n, 2, 80}] (* _Stefan Steinerberger_, Mar 14 2006 *)

%t Table[NextPrime[FactorInteger[n][[1, 1]], -1] /. -2 -> 1, {n, 96}] (* _Michael De Vlieger_, Sep 16 2017 *)

%Y Cf. A117364, A117366, A117367, A117368.

%K nonn

%O 1,3

%A _Leroy Quet_, Mar 10 2006

%E More terms from _Stefan Steinerberger_, Mar 14 2006

%E More terms from _Franklin T. Adams-Watters_, Aug 29 2006