OFFSET
1,4
COMMENTS
This variation of the Josephus problem is related to under-down-under card dealing.
LINKS
Eric Huang, Tanya Khovanova, Timur Kilybayev, Ryan Li, Brandon Ni, Leone Seidel, Samarth Sharma, Nathan Sheffield, Vivek Varanasi, Alice Yin, Boya Yun, and William Zelevinsky, Card Dealing Math, arXiv:2509.11395 [math.NT], 2025. See p. 17.
EXAMPLE
Consider 4 people in a circle in order 1,2,3,4. In the first round, person 1 is skipped, then person 2 is eliminated, then person 3 is skipped. Now people are in order 4,1,3. In the second round, person 4 is skipped, person 1 is eliminated, and person 3 is skipped. Now people are in order 4,3. In the third round person 3 is eliminated. Person 4 is freed. Thus, a(4) = 4.
PROG
(Python)
def J(n, A):
l=[]
for i in range(n):
l.append(i+1)
index = 0
P=[]
for i in range(n):
index+=A[i]
index=index%len(l)
P.append(l[index])
l.pop(index)
return P
def invPerm(p):
inv = []
for i in range(len(p)):
inv.append(None)
for i in range(len(p)):
inv[p[i]-1]=i+1
return inv
def survivor(n, A):
return J(n, A)[n-1]
def UDU(n):
return [1] + [2 for i in range(n)]
seq = []
for i in range(1, 20):
seq += [survivor(i, UDU(i))]
print(", ".join([str(v) for v in seq]))
(Python)
def a(n):
c, i, J = 1, 0, list(range(1, n+1))
while len(J) > 1:
i = (i + 1)%len(J)
q = J.pop(i)
i = (i + 1)%len(J) # skip the third
return J[0]
print([a(n) for n in range(1, 73)]) # Michael S. Branicky, Mar 24 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Mar 22 2025
STATUS
approved
