OFFSET
1,3
EXAMPLE
For a(3), the permutation 1 2 3 counts as a win. This is what happens:
1 2 3
2 3 1 (1 card to the back)
1 2 3 (2 cards to the back)
Win!
For a(3), the permutation 1 3 2 is not counted:
1 3 2
3 2 1 (1 card to the back)
3 2 1 (3 cards to the back)
Infinite loop: lose!
For a(4), the permutation 2 1 3 4 is not counted:
2 1 3 4
3 4 2 1
1 3 4 2
3 4 2 1
Infinite loop: lose!
PROG
(Python)
from itertools import permutations
def a(n):
seq = list(range(1, n+1))
t = 0
for p in permutations(seq):
i = 0
for step in range(n):
i += p[i]
if i == n:
t += 1
break
i = i % n
return t
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Christian Perfect, Oct 03 2025
EXTENSIONS
a(12)-a(14) from Michael S. Branicky, Oct 07 2025
a(15)-a(18) from Jason Yuen, Oct 07 2025
a(19)-a(20) from Jason Yuen, Oct 16 2025
STATUS
approved
