OFFSET
1,4
LINKS
FORMULA
a(n) = (a(n-1) + 5) mod n + 1 if n > 1, a(1) = 1.
EXAMPLE
a(7) = 3 because the elimination process gives (^1,2,3,4,5,6,7) -> (1,2,3,4,5,^7) -> (1,2,3,4,^7) -> (^1,2,3,4) -> (1,^3,4) -> (^3,4) -> (3), where ^ denotes the counting reference position.
a(13) = 9 => a(14) = (a(13) + 5) mod 14 + 1 = 1.
MATHEMATICA
a[1] = 1; a[n_] := a[n] = Mod[a[n - 1] + 5, n] + 1; Array[a, 100] (* Amiram Eldar, Feb 03 2023 *)
PROG
CROSSREFS
KEYWORD
nonn
AUTHOR
Benjamin Lilley, Jan 31 2023
STATUS
approved