OFFSET
1,2
COMMENTS
The graph of this sequence gives it the appearance of a ruler-like function. If n is odd, a(n) = 1. If n is even and not a multiple of 6, a(n) = 2. If n is a multiple of 6 but not of 12, a(n) = 6, and so on.
LINKS
Hal M. Switkay, Table of n, a(n) for n = 1..5040
EXAMPLE
a(18) = 6 as 18 is divisible by lcm(1, 2, 3) = 6 but not by lcm(1, 2, 3, 4) = 12. so 6 is the largest divisor of 18 that is a term of A003418. - David A. Corneth, Jan 28 2024
MATHEMATICA
seq[max_] := Module[{lcms = Table[LCM @@ Range[k], {k, max}]}, Table[Max[Select[Divisors[k], MemberQ[lcms, #] &]], {k, 1, max}]]; seq[100] (* Amiram Eldar, Jan 12 2024 *)
PROG
(PARI) a(n) = for(i = 2, n, if(n%i != 0, return(lcm([1..i-1])))); n \\ David A. Corneth, Jan 27 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Hal M. Switkay, Jan 11 2024
STATUS
approved