OFFSET
1,3
LINKS
Pontus von Brömssen, Antidiagonals n = 1..100, flattened
James Dowdy and Michael E. Mays, Josephus permutations, Journal of Combinatorial Mathematics and Combinatorial Computing 6 (1989), 125-130.
Wikipedia, Josephus problem
EXAMPLE
Array begins:
n\k| 1 2 3 4 5 6 7 8 9 10
---+------------------------------
1 | 1 1 1 1 1 1 1 1 1 1
2 | 2 1 2 1 2 1 2 1 2 1
3 | 3 2 1 2 1 2 3 2 1 2
4 | 4 2 2 2 2 2 2 2 2 2
5 | 5 1 1 1 3 3 1 3 3 3
6 | 6 1 2 3 2 3 2 1 2 3
7 | 7 4 3 2 3 2 3 2 5 2
8 | 8 2 2 2 4 2 2 4 6 2
9 | 9 1 3 5 3 3 3 3 3 3
10 | 10 5 2 1 2 3 2 1 2 3
For n = 4, k = 2, the order of elimination is (2,4,3,1) (row 4 of A321298). This permutation has two cycles, (1 2 4) and (3), so T(4,2) = 2.
PROG
(Python)
from sympy.combinatorics import Permutation
def A357217(n, k):
return Permutation.josephus(k, n).cycles
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Pontus von Brömssen, Sep 18 2022
STATUS
approved