A386312 Numbers of people such that the last person is freed in the variant of the Josephus problem in which one person is skipped, then one is eliminated, then two people are skipped and one eliminated, then three people are skipped and so on.
1, 7, 10, 12, 21, 25, 28, 235, 822, 24886, 99607, 101497, 107716, 5756103, 55480598
Offset: 1
Examples
Suppose there are people 1,2,3,4,5,6,7 in a circle. We first skip one person and eliminate the next, leaving people in order 3,4,5,6,7,1. Now, we skip two people and eliminate the next, leaving 6,7,1,3,4. Now, we skip three and eliminate the next, leaving 4,6,7,1. Now, we skip four and eliminate the next, leaving 6,7,1. Now, we skip five and eliminate the next, leaving 6,7. Finally, we skip six and eliminate the next, leaving just 7. As the last person in the circle was freed, 7 belongs to this sequence.
Programs
-
Python
def F(n): c, i, J = 1, 0, list(range(1, n+1)) while len(J) > 1: i = (i + c) % len(J) q = J.pop(i) c = c + 1 return J[0] print([n for n in range(1, 100000) if F(n) == n])
Extensions
a(15) from Jinyuan Wang, Aug 31 2025
Comments