OFFSET
1,2
COMMENTS
This sequence can be used in magic tricks with under-under-under-down dealing pattern. The deck sizes in this sequence guarantee that after the dealing, the last dealt card is the one that was initially on top.
The classical Josephus problem corresponds to under-down dealing. In this case, the first person is freed when the number of people is a power of 2: A000079.
If two people are skipped, then the corresponding sequence is A081614.
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. 18.
EXAMPLE
Suppose there are 5 people in a circle. After three people are skipped, the person number 4 is eliminated. The leftover people are 5,1,2,3 in order. Then person number 3 eliminated, and the leftover people are 5,1,2 in order. Then person number 5 is eliminated, and the leftover people are 1,2 in order. Then person number 2 is eliminated, and person 1 is freed. Thus, 5 is in this sequence.
PROG
(Python)
def freed_person_sequence_periodic(trailingUs, periodic_portion, numterms):
freed_person_table=[[0] for i in periodic_portion]
for i in range(numterms):
extend_freed_person_sequence(periodic_portion, freed_person_table)
return [(freed_person_table[0][N] - trailingUs)%(N+1)+1 for N in range(len(freed_person_table[0]))]
def extend_freed_person_sequence(periodic_portion, freed_person_table):
for offset in range(len(periodic_portion)):
first_death = periodic_portion[offset]
remaining_survivor = freed_person_table[(offset + 1)%len(periodic_portion)][len(freed_person_table[offset])-1]
if remaining_survivor + first_death + 1 < len(freed_person_table[offset])+ 1:
freed_person_table[offset].append(remaining_survivor + first_death + 1)
else:
freed_person_table[offset].append((remaining_survivor + first_death + 1) % (len(freed_person_table[offset]) + 1))
def first_freers_periodic(trailingUs, periodic_portion, numterms):
freed_seq = freed_person_sequence_periodic(trailingUs, periodic_portion, numterms)
return [i+1 for i in range(len(freed_seq)) if freed_seq[i] == 1]
print(first_freers_periodic(0, [3], 100000000))
CROSSREFS
KEYWORD
nonn
AUTHOR
Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Jun 25 2025
EXTENSIONS
More terms from Jinyuan Wang, Jul 01 2025
STATUS
approved
