cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A198789 Array T(n,k) read by antidiagonals: Last survivor positions in Josephus problem for n numbers and a count of k, n >= 1, k >= 1.

Original entry on oeis.org

1, 1, 2, 1, 1, 3, 1, 2, 3, 4, 1, 1, 2, 1, 5, 1, 2, 2, 1, 3, 6, 1, 1, 1, 2, 4, 5, 7, 1, 2, 1, 2, 1, 1, 7, 8, 1, 1, 3, 3, 2, 5, 4, 1, 9, 1, 2, 3, 2, 4, 1, 2, 7, 3, 10, 1, 1, 2, 3, 4, 4, 6, 6, 1, 5, 11, 1, 2, 2, 3, 1, 5, 3, 3, 1, 4, 7, 12, 1, 1, 1, 4, 2, 3, 5, 1, 8, 5, 7, 9, 13
Offset: 1

Views

Author

William Rex Marshall, Nov 21 2011

Keywords

Comments

Arrange 1, 2, 3, ..., n clockwise in a circle. Starting the count at 1, delete every k-th integer clockwise until only one remains, which is T(n,k).
The main diagonal (1, 1, 2, 2, 2, 4, 5, 4, ...) is A007495.
Concatenation of consecutive rows (up to the main diagonal) gives A032434.
The periods of the rows, (1, 2, 6, 12, 60, 60, 420, 840, ...), is given by A003418.

Examples

			.n\k  1  2  3  4  5  6  7  8  9 10
----------------------------------
.1 |  1  1  1  1  1  1  1  1  1  1
.2 |  2  1  2  1  2  1  2  1  2  1
.3 |  3  3  2  2  1  1  3  3  2  2
.4 |  4  1  1  2  2  3  2  3  3  4
.5 |  5  3  4  1  2  4  4  1  2  4
.6 |  6  5  1  5  1  4  5  3  5  2
.7 |  7  7  4  2  6  3  5  4  7  5
.8 |  8  1  7  6  3  1  4  4  8  7
.9 |  9  3  1  1  8  7  2  3  8  8
10 | 10  5  4  5  3  3  9  1  7  8
		

Crossrefs

Cf. A000027 (k = 1), A006257 (k = 2), A054995 (k = 3), A088333 (k = 4), A181281 (k = 5), A360268 (k = 6), A178853 (k = 7), A109630 (k = 8).
Cf. A003418, A007495 (main diagonal), A032434, A198788, A198790.

Programs

  • Mathematica
    T[n_, k_] := T[n, k] = If[n == 1, 1, Mod[T[n-1, k]+k-1, n]+1];
    Table[T[n-k+1, k], {n, 1, 13}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Mar 04 2023 *)

Formula

T(1,k) = 1; for n > 1: T(n,k) = ((T(n-1,k) + k - 1) mod n) + 1.

A198790 Irregular table T(n,k) read by rows: Last survivor positions in Josephus problem for n numbers and a count of k, n >= 1, lcm(1, 2, 3, ..., n) >= k >= 1.

Original entry on oeis.org

1, 2, 1, 3, 3, 2, 2, 1, 1, 4, 1, 1, 2, 2, 3, 2, 3, 3, 4, 4, 1, 5, 3, 4, 1, 2, 4, 4, 1, 2, 4, 5, 3, 2, 5, 1, 3, 4, 1, 1, 3, 4, 1, 2, 5, 4, 2, 3, 5, 1, 3, 3, 5, 1, 3, 4, 2, 1, 4, 5, 2, 3, 5, 5, 2, 3, 5, 1, 4, 3, 1, 2, 4, 5, 2, 2, 4, 5, 2, 3, 1, 6, 5, 1, 5, 1, 4
Offset: 1

Views

Author

William Rex Marshall, Nov 21 2011

Keywords

Comments

Arrange 1, 2, 3, ... n clockwise in a circle. Starting the count at 1, delete every k-th integer clockwise until only one remains, which is T(n,k).
In the full table in A198789, row n repeats with a periodicity of lcm(1, 2, 3, ..., n) = A003418(n). This sequence is a scan of each row in A198789 for exactly one period length.

Examples

			n\k  1  2  3  4  5  6  7  8  9 10 11 12
---------------------------------------
1 |  1
2 |  2  1
3 |  3  3  2  2  1  1
4 |  4  1  1  2  2  3  2  3  3  4  4  1
		

Crossrefs

Formula

T(1,1) = 1;
for n >= 2, lcm(1, 2, ... n) >= k >=1: T(n,k) = ((T(n-1,((k-1) mod lcm(1, 2, ... n-1)) + 1) + k - 1) mod n) + 1.

A198791 Least count k that deletes the alternate (odd) numbers in the Josephus problem for a circle of numbers 1, 2, 3, ... 2*n, leaving the even numbers undeleted.

Original entry on oeis.org

1, 5, 19, 27, 87, 989, 3119, 5399, 8189, 99663, 57455, 222397, 2603047, 8476649, 117917347, 290190179, 360064247, 1344262919, 3181391639, 39179386959, 204692414215, 165424388219, 2254874520599, 2922139183443, 594630799853
Offset: 1

Views

Author

William Rex Marshall, Nov 21 2011

Keywords

Comments

Arrange 1, 2, 3, ... 2*n clockwise in a circle. Starting the count at 1, delete every k-th integer clockwise until exactly half of the numbers have been deleted. a(n) is the least positive integer k for which the deleted numbers are the odd numbers.
Deleting the alternate (even) numbers from a circle of 2*n numbers leaving the odd numbers is trivially achieved with k = 2 for all n >= 1.

Crossrefs

Showing 1-3 of 3 results.