По аналогии с решетом Эратосфена существует решето Иосифа Флавия. Условия следующие:
Цитата:
Start with the natural numbers; at the k-th sieving step, remove every (k+1)-st term of the sequence remaining after the (k-1)-st sieving step; iterate.
Начните с натуральных чисел; на

-м шаге просеивания удалите каждый

-й член последовательности, оставшийся после

-го шага просеивания; повторите.
Вот как это работает:
![$$[1], (2), 3, (4), 5, (6), 7, (8), 9, (10), 11, (12), 13, (14), 15, (16), 17, (18), 19, (20)$$ $$[1], (2), 3, (4), 5, (6), 7, (8), 9, (10), 11, (12), 13, (14), 15, (16), 17, (18), 19, (20)$$](https://dxdy-01.korotkov.co.uk/f/c/2/b/c2b58e195ff952a4c38888d086e9e0d782.png)
![$$[1], [3], (5), 7, 9, (11), 13, 15, (17), 19, 21, (23), 25, 27, (29), 31, 33, (35)$$ $$[1], [3], (5), 7, 9, (11), 13, 15, (17), 19, 21, (23), 25, 27, (29), 31, 33, (35)$$](https://dxdy-02.korotkov.co.uk/f/5/7/e/57eb453561dd910cb406c503a1d59e0c82.png)
![$$[1], [3], [7], (9), 13, 15, 19, (21), 25, 27, 31, (33), 37, 39, 43, (45)$$ $$[1], [3], [7], (9), 13, 15, 19, (21), 25, 27, 31, (33), 37, 39, 43, (45)$$](https://dxdy-04.korotkov.co.uk/f/b/d/5/bd5f126c4d328bde1112250c7e82049782.png)
![$$[1], [3], [7], [13], (15), 19, 25, 27, 31, (37), 39, 43, 49, 51, (55)$$ $$[1], [3], [7], [13], (15), 19, 25, 27, 31, (37), 39, 43, 49, 51, (55)$$](https://dxdy-01.korotkov.co.uk/f/8/c/7/8c794a5161f1db3800990675a5812f3982.png)
![$$[1], [3], [7], [13], [19], (25), 27, 31, 39, 43, 49, (51)$$ $$[1], [3], [7], [13], [19], (25), 27, 31, 39, 43, 49, (51)$$](https://dxdy-02.korotkov.co.uk/f/9/c/7/9c73d517995c672fd1a44271b2f0e19f82.png)
Результирующая последовательность

(
A000960) начинается так:

В отличии от простых чисел здесь существует относительно простая закономерность, которая позволяет за

итераций превращать

в

:
Цитата:
(PARI) a(n)=local(A=n, D); for(i=1, n-1, D=n-i; A=D*ceil(A/D+1)); return(A) \\ Paul D. Hanna, Oct 10 2005
Пусть задана последовательность

(
A278528) - номер шага просеивания, на котором

выбывает при применении решета Иосифа Флавия. Если же

остается, то

.
Пусть задано относительно большое число

. Известно, что оно гарантированно выбывает при просеивании. Известно также, что

, где

это номер шага просеивания, на котором выбывает

, а

это некоторое число, удовлетворяющее условиям неравенства.
Определите

вычисляя максимум

различных значений.