OFFSET
1,2
EXAMPLE
There are four positive divisors of 15: (1,3,5,15). There are two divisors, 3 and 5, that are nearest 4. We take the larger divisor, 5 in this case, in case of a tie; so a(15) = 5.
MAPLE
A138223 := proc(n) if n = 1 then RETURN(1); fi; t := numtheory[tau](n) ; dvs := sort(convert(numtheory[divisors](n), list)) ; a := op(-1, dvs) ; for i from 2 to nops(dvs) do if abs(op(-i, dvs) - t) < abs(a-t) then a := op(-i, dvs) ; fi; od: a ; end: seq(A138223(n), n=1..120) ; # R. J. Mathar, Jul 20 2009
MATHEMATICA
a[n_] := With[{d = Divisors[n]}, Nearest[d, Length[d]][[-1]]];
Table[a[n], {n, 1, 101}] (* Jean-François Alcover, Oct 18 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Mar 06 2008
EXTENSIONS
Extended beyond a(15) by R. J. Mathar, Jul 20 2009
STATUS
approved