OFFSET
1,2
COMMENTS
EXAMPLE
n = 4; divisors: [1,2,4]; subsets: [[], [1], [2], [4], [1, 2], [1, 4], [2, 4], [1, 2, 4]]; products: [1, 1, 2, 4, 2, 4, 8, 8]; the maximal product that is lesser than 4 is 2, so a(4) = 2.
MATHEMATICA
If[PrimeQ@n || n == 1, n,
Last@Select[Union[Times @@@ Subsets[Divisors@n]], # < n &]];
PROG
(PARI) a(n) = my(d=divisors(n), nb = #d, m=1); forsubset(nb, s, my(p=vecprod(vector(#s, k, d[s[k]]))); if (p<n, m=max(m, p))); if (m>1, m, n); \\ Michel Marcus, Jun 17 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Denis Ivanov, Jun 12 2023
STATUS
approved