OFFSET
1,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
EXAMPLE
The divisors of 6 are 1, 2, 3, 6, which reversed is 6,3,2,1; repeating that produces the sequence 6, 3, 2, 1, 6, 3, 2, 1, 6, 3, 2, 1, ...; the 6th term in that sequence is 3, so a(6) = 3.
MAPLE
with(numtheory):
a:= n-> n/(l-> l[1+irem(n-1, nops(l))])(sort([divisors(n)[]])):
seq(a(n), n=1..100); # Alois P. Heinz, Jan 29 2018
MATHEMATICA
Table[PadRight[{}, n, Reverse[Divisors[n]]][[-1]], {n, 100}] (* Harvey P. Dale, Jul 21 2024 *)
PROG
(PARI) a(n) = my(d=Vecrev(divisors(n))); if (n % #d, d[n % #d], 1); \\ Michel Marcus, Jan 26 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Franklin T. Adams-Watters, Jan 25 2018
STATUS
approved