login
A122377
a(n) is the n-th term in periodic sequence repeating the divisors of n in increasing order.
4
1, 2, 1, 1, 1, 2, 1, 8, 9, 2, 1, 12, 1, 2, 5, 1, 1, 18, 1, 2, 1, 2, 1, 24, 1, 2, 9, 7, 1, 10, 1, 2, 1, 2, 7, 36, 1, 2, 13, 40, 1, 2, 1, 2, 5, 2, 1, 16, 1, 2, 17, 13, 1, 18, 11, 56, 1, 2, 1, 60, 1, 2, 7, 1, 1, 2, 1, 2, 1, 14, 1, 72, 1, 2, 5, 19, 1, 26, 1, 80, 1, 2, 1, 84, 1, 2, 29, 88, 1, 9, 13, 2, 1, 2
OFFSET
1,2
COMMENTS
Old name: a(n) = m-th positive divisor of n, where d(n) is number of positive divisors of n and m = d(n) if d(n)|n, else m = n mod d(n).
LINKS
EXAMPLE
The divisors of 6 are 1, 2, 3, 6; repeating that produces the sequence 1, 2, 3, 6, 1, 2, 3, 6, 1, 2, 3, 6, ...; the 6th term in that sequence is 2, so a(6) = 2.
MAPLE
with(numtheory):
a:= 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
f[n_] := Block[{d = Divisors[n]}, d[[Mod[n, Length[d], 1]]]]; Table[f[n], {n, 100}] (* Ray Chandler, Oct 26 2006 *)
Table[PadRight[{}, n, Divisors[n]][[-1]], {n, 100}] (* Harvey P. Dale, Jun 05 2022 *)
PROG
(PARI) a(n) = my(d=divisors(n)); if (n % #d, d[n % #d], n); \\ Michel Marcus, Jan 26 2018
CROSSREFS
Cf. A000005, A122383, A124332, A298734 (n/a(n)).
Cf. A033950 (fixed points). [From Franklin T. Adams-Watters, Jul 11 2009]
Sequence in context: A330742 A104308 A175456 * A293900 A284463 A169758
KEYWORD
nonn
AUTHOR
Leroy Quet, Oct 19 2006
EXTENSIONS
Edited and extended by Ray Chandler, Oct 26 2006
New name from Franklin T. Adams-Watters, Jan 25 2018
STATUS
approved