close
login
A385327
The numbers of people such that, in the variant of the Josephus problem in which three people are skipped and then one is eliminated, the first person is the last to be eliminated.
1
1, 2, 5, 9, 12, 16, 218, 517, 1226, 6890, 12249, 16332, 21776, 38713, 122353, 687461, 1222153, 51443354, 385389994, 1218022698, 1624030264, 2887164914, 5132737625, 9124866889, 28839085477, 162036891790, 910429504490, 2877406829006, 5115389918233, 510385736583765
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))
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