OFFSET
1,2
REFERENCES
Paul Weisenhorn, Josephus und seine Folgen, MNU Journal (Der mathematische und naturwissenschaftliche Unterricht), 59 (2006), 18-19.
FORMULA
a(n) = (a(n-1) + 4) mod n + 1 if n>1, a(1) = 1.
EXAMPLE
a(7) = 6: (^1,2,3,4,5,6,7) -> (1,2,3,4,^6,7) -> (1,2,^4,6,7) -> (1,^4,6,7) -> (1,^6,7) -> (^1,6) -> (^6).
a(14) = 11 => a(15) = (a(14)+4) mod 15 + 1 = 1.
MAPLE
a:= proc(n) option remember;
`if` (n=1, 1, (a(n-1)+4) mod n +1)
end:
seq (a(n), n=1..100);
MATHEMATICA
a[1] = 1; a[n_] := a[n] = Mod[a[n-1]+4, n]+1; Table[a[n], {n, 1, 80}] (* Jean-François Alcover, Oct 18 2013 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul Weisenhorn, Oct 10 2010
EXTENSIONS
Edited by Alois P. Heinz, Sep 06 2011
STATUS
approved