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, 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
Keywords
Examples
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.
Programs
-
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))
Extensions
More terms from Jinyuan Wang, Jul 01 2025
Comments