A087040 2nd largest prime factor of n-th composite number.
2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 2, 3, 2, 2, 5, 2, 3, 2, 3, 2, 3, 2, 5, 3, 2, 3, 2, 3, 2, 3, 2, 2, 7, 5, 3, 2, 3, 5, 2, 3, 2, 3, 2, 3, 2, 5, 3, 2, 3, 5, 3, 2, 5, 2, 7, 3, 2, 3, 2, 3, 5, 2, 3, 2, 3, 7, 2, 3, 2, 5, 2, 7, 3, 5, 3, 2, 5, 2, 3, 5, 3, 2, 3, 5, 2, 3, 2, 7, 3, 11, 2, 3, 2, 5, 3, 2, 3, 5, 3, 7, 2, 3
Offset: 1
Keywords
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
f:= proc(n) local F; if isprime(n) then return NULL fi; F:= sort(ifactors(n)[2],(a,b) -> a[1]>b[1]); if F[1][2] >= 2 then F[1][1] else F[2][1] fi end proc: map(f, [$2..200]); # Robert Israel, Feb 20 2024
-
Mathematica
Table[l=FactorInteger[ResourceFunction["Composite"][n]];If[Last[l][[2]]>1,Last[l][[1]],First[Part[l,-2]]],{n,102}] (* James C. McMahon, Feb 20 2024 *)
Comments