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.

User: Ruediger Jehn

Ruediger Jehn's wiki page.

Ruediger Jehn has authored 27 sequences. Here are the ten most recent ones:

A387262 a(n) is the denominator of the winning probability of the starting player to reach n points first in the game "Risk or Safety", assuming optimal play.

Original entry on oeis.org

3, 7, 11, 4165, 1925, 521145625, 1231278125, 117192622421875, 5225432428125, 10634368774326171875, 64913928515324560546875, 6519012951936493553466796875, 420117998909827688127861328125, 217038092253876925088545128021240234375, 27711032758513212360715995025634765625
Offset: 1

Author

Ruediger Jehn, Aug 24 2025

Keywords

Comments

For more details see A387260 and A387261.

Examples

			a(2) = 7: For n=2, the optimal strategy is never to stop, but always try to get two consecutive heads. The winning probability is 1/4*(1 + (3/4)^2 + (3/4)^4 + ...) = 4/7.
		

Crossrefs

A387261 are the corresponding numerators.

Extensions

More terms from Jinyuan Wang, Aug 29 2025

A387261 a(n) is the numerator of the winning probability of the starting player to reach n points first in the game "Risk or Safety", assuming optimal play.

Original entry on oeis.org

2, 4, 6, 2236, 1026, 275848876, 649346842, 61550866190068, 2737872156886, 5556238701119487884, 33857036312840796476194, 3393041394611453189295265268, 218370486707916654640780231642, 112630244896738642814653528498087299988, 14364898791782224577113184680141626682
Offset: 1

Author

Ruediger Jehn, Aug 24 2025

Keywords

Comments

The total number of different strategies is given in A387260. See there for more information.

Examples

			a(2) = 4: For n=2, the optimal strategy is never to stop, but always try to get two consecutive heads. The winning probability is 1/4*(1 + (3/4)^2 + (3/4)^4 + ...) = 4/7.
		

Crossrefs

A387262 are the corresponding denominators.

Extensions

More terms from Jinyuan Wang, Aug 29 2025

A387260 Number of strategies in the game "Risk or Safety" to reach n points.

Original entry on oeis.org

1, 3, 31, 3011, 5755251, 357035589531
Offset: 1

Author

Ruediger Jehn, Aug 24 2025

Keywords

Comments

The game "Risk or Safety" consists of two competing players. A player whose turn it is tosses a coin. If it is heads they earn a point, and they can choose to go for safety, put the point aside in a save box, and give the turn to their opponent. Or they take the risk to continue and toss the coin again. If it is heads again, the number of "open" points increases by one, and they can choose again to continue or stop, converting the "open" points to "saved" points. Whenever it is tails, all the open points are lost, and it is the turn of the other player. Who collects n points first wins.
If a game situation is described by a triple (a, b, c) with a = open points, b = saved points of the player whose turn it is, and c = saved points of the opponent, then the number of possible game situations is n^2(n + 1)/2 = A002411(n). One possibility to calculate the optimal strategy is to examine each triple with a > 0, derive the possible follow-on triples for each possible strategy at this situation, and determine for each stop/continue combination the one with the largest winning probability at this point in the decision tree of all strategies. It is assumed that one optimal strategy exists that both players are playing. For all possible strategies, a system of A002411(n) linear equations needs to be solved. Another approach is to simulate the game iteratively, selecting the solution with the highest winning probability after k turns, and continuing this process until no further improvements are made. Both methods have given the same results, although the matrix approach breaks down for n >= 6, since the inversion of hundreds of billions of 126 X 126 matrices is just not feasible.
The optimal solution for n = 3 is to stop at (1, 0, 0), else always continue. The average game duration is 6 (n = 2), 120/11 (n = 3), 258/17 (n = 4), and 5532/275 (n = 5).

Examples

			a(2) = 3: For n = 2, we have two game situations (1, 0, 0) and (1, 0, 1) where the players need to decide whether to stop or to continue. If the players choose to stop at (1, 0, 0) there are two strategies at (1, 0, 1): stop and continue. However, if the players choose to continue at (1, 0, 0), the position (1, 0, 1) will never be reached, and therefore in total, there exist only 3 strategies, not 4.
		

Crossrefs

A386463 Box which a player should open at step n to catch a cat performing a random walk through 8 boxes to minimize the escape rate of the cat.

Original entry on oeis.org

1, 7, 7, 1, 2, 2, 4, 7, 7, 2, 3, 4, 7, 1, 8, 7, 2, 3, 7, 7, 6, 2, 2, 3, 6, 8, 1, 8, 7, 6, 1, 2, 3, 4, 7, 1, 8, 7, 2, 3, 7, 7, 6, 2, 2, 3, 6, 8, 1, 8, 7, 6, 1, 2, 3, 4, 7, 1, 8, 7, 2, 3, 7, 7, 6, 2, 2, 3, 6, 8, 1, 8, 7, 6, 1, 2, 3, 4, 7, 1, 8, 7, 2, 3, 7, 7, 6
Offset: 1

Author

Ruediger Jehn, Jul 22 2025

Keywords

Comments

A cat is randomly hiding in one of 8 boxes, and a single player tries to catch the cat. In each step, the player opens a box. If the cat is found, the game ends; if not, the cat will move randomly either to the box on the left or to the box on the right. If the cat is in box 1 or 8, it has a 50% probability of escaping. By using the optimal strategy, the cat's escape rate is minimized to 0.223305988. The average duration of the game is 5.35 steps. Note that, since the problem is symmetric, a mirrored strategy also exists.

Examples

			a(1) = 1: 0.223306 is an upper bound for the minimum escape rate. If the player starts with box 2 (or 7) the escape rate exceeds this value at least after 11 steps no matter in which order the player will open the next boxes. If the player starts with box 3 (or 6) the escape rate exceeds the bound at least after 7 steps and if the player starts with box 4 (or 5) the escape rate exceeds the bound at least after 6 steps. Hence opening box 1 (or 8 for the mirrored strategy) allows the player to minimize the escape rate of the cat.
		

Crossrefs

Extensions

More terms from Jinyuan Wang, Jul 27 2025

A386462 Box which a player should open at step n to catch as fast as possible a cat performing a random walk through 8 boxes.

Original entry on oeis.org

4, 7, 5, 2, 7, 4, 2, 5, 7, 7, 4, 2, 2, 4, 7, 7, 4, 2, 2, 4, 7, 7, 4, 4, 7, 2, 4, 7, 2, 5, 5, 2, 7, 4, 4, 7, 2, 5, 5, 2, 7, 4, 4, 7, 2, 5, 5, 2, 7, 4, 4, 7, 2, 5, 5, 2, 7, 4, 4, 7, 2, 5, 5, 2, 7, 4, 2, 5, 7, 7, 5, 2, 4, 7, 2, 5, 5, 2, 7, 4, 2, 5, 7, 7, 5, 2, 4
Offset: 1

Author

Ruediger Jehn, Jul 22 2025

Keywords

Comments

A cat is randomly hiding in one of 8 boxes and a single player tries to catch the cat. In each step, first the player opens a box, if the cat is found, the game is finished, if not the cat will move randomly one box to the left or one box to the right. If the cat is in box 1 it can only move to box 2 in the next step. A safe strategy to find the cat in no more than 12 steps is to open the boxes in this order: 2,3,4,5,6,7,7,6,5,4,3,2. On average this strategy takes 25963/4096 (6.339) steps to catch the cat. However, applying the strategy to open box a(n) at step n reduces the average duration of the game to 4.749593 which is a factor of 1.335 faster. Note, since the problem is symmetric also a mirrored strategy exists.

Examples

			a(1) = 4: If the player starts with box 1 (or 8) the average duration of the game exceeds the value of 4.7496 at least after 10 steps no matter in which order the player will open the next boxes. If the player starts with box 2 (or 7) the average duration of the game exceeds the value of 4.7496 at least after 25 steps and if the player starts with box 3 (or 6) the average duration of the game exceeds the value of 4.7496 at least after 11 steps. Hence opening box 4 (or 5 for the mirrored strategy) allows the player to catch the cat in the fastest way.
		

Crossrefs

Extensions

More terms from Jinyuan Wang, Jul 29 2025

A383856 Dimension in which a random vector of length n has the highest probability to fall into a single hypercube with side length of 10.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 2, 4
Offset: 1

Author

Ruediger Jehn, May 12 2025

Keywords

Comments

Conjecture: a(11)..a(16) are 5, 6, 8, 9, 11, 12 with at least 99.7% confidence (based on numerical simulation discussed below).
Let L be the ratio of vector length to side length of a hypercube. If L <= 1 the probability P that a vector with random start and random orientation falls completely inside one hypercube can be calculated with one integral, e.g. in case of four dimensions: P_4(L) = (8/Pi^2)*Integral_{0..Pi/2} Integral_{0..Pi/2} Integral_{0..Pi/2} (1 - L * cos(x) * cos(y) * cos(z)) * (1 - L * sin(x) * cos(y) * cos(z)) * (1 - L * sin(y) * cos(z)) * (1 - L * sin(z)) * cos(y) * cos^2(z) dx dy dz = 1 - 16*L/(3*Pi) + 3*L^2/Pi - 32*L^3/(15*Pi^2) + L^4/(6*Pi^2). If L > 1, the probability needs to be integrated over multiple parts which leads to elliptical integrals in the case of three dimensions. Therefore for L > 1, numerical simulations were applied (see Python code below).

Examples

			The probability P_1(0.9) that a one-dimensional vector of length 9 with a random start point does not cross the grid lines spaced by 10 units equals 1 - L = 10% (L=9/10). The probability P_2(0.9) that a two-dimensional vector of the same length with a random start point and a random orientation does not cross the lines of a 10 X 10 grid equals (2/Pi) * Integral_{0..Pi/2} (1 - L * cos(x)) * (1 - L * sin(x)) dx = 1 - L*(4-L)/Pi = 11.2%. The probability P_3(0.9) that a random three-dimensional vector of the same length does not cross the lines of a 10 X 10 X 10 grid equals (2/Pi) * Integral_{0..Pi/2} Integral_{0..Pi/2} (1 - L * cos(x) * cos(y)) * (1 - L * sin(x) * cos(y)) * (1 - L * sin(y)) * cos(y) dx dy = 1 - 1.5 L + 2 L^2/Pi - L^3/(4*Pi) = 10.7%.
The highest probability not to cross any grid line is in case of a two-dimensional vector and therefore a(9) = 2.
		

Programs

  • Python
    def random_point_on_sphere(dim):
        vec = abs(np.random.normal(0, 1, dim))  # Sample from standard normal (only positive values)
        vec /= np.linalg.norm(vec)      # Normalize to unit length
        return vec
    L = 1.3  # pencil length, relative to hypercube side length
    nsample = 100000000
    for dim in range(7,10): # explore only dimensions which are interesting for length L
        count = 0
        for i in range(nsample):
            x0 = np.random.random(dim)  # start point of pencil
            pencil = L*random_point_on_sphere(dim)
            k=0
            while x0[k] + pencil[k] <= 1: # check dimension k if grid line is crossed
                if k == n-1:
                    count += 1
                    break
                else:
                    k += 1
        print(dim, count)
    p = count/nsample
    # if the difference in the counts is smaller than the confidence interval, repeat with a larger nsample
    print("Half-width of 99% confidence interval:", 2.58*sqrt(nsample*p*(1-p)))

A380592 Number of ways that a European soccer league tournament with n teams can complete with all teams having the same number of points.

Original entry on oeis.org

1, 3, 27, 1083, 296081, 696779523, 16503494334993, 3439079361325736243
Offset: 1

Author

Ruediger Jehn, Jan 27 2025

Keywords

Comments

Teams play each other twice for a total of M = n*(n-1) matches.
A victory is awarded 3 points, a draw 1 point and a defeat 0 points.
The total number of possible match outcomes is 3^M = A053764(n) and a(n) is how many of them result in all teams finishing with the same points score.
If all matches were randomly assigned a result, the probability that all teams would end up with the same number of points is a(n)/A053764(n), which in a typical league of 18 or 20 teams is very small.
A007080(n) is the number of ways if there are no draws.

Examples

			We denote the vector (r1, r2 ... r_M) with r_i in {0, 1, 3} as a possible sequence of match results. Then a(2) = 3: (0, 0) - both teams lose their home game and have 3 points at the end, (1,1) - both matches end with a draw and both teams have 2 points, (3,3) - both teams win their home game and have 3 points.
		

Crossrefs

A377757 Number of possibilities to place "hat" monotiles onto the first n hexagons in a counterclockwise order such that more rings of tiles can be placed around it.

Original entry on oeis.org

1, 3, 7, 9, 10, 15, 18, 22, 23, 26, 26, 30, 32, 35, 37, 43, 44, 44, 44, 51, 51, 56, 60, 60, 65, 69, 74, 80, 86, 86, 86, 94, 94, 94, 100, 105, 109
Offset: 1

Author

Ruediger Jehn and Kester Habermann, Nov 06 2024

Keywords

Comments

Fig. 1.1 in the paper "An aperiodic monotile" by Smith et al. (2023) shows an example of tiling the plane with "hat" monotiles. A "hat" monotile covers two thirds of a hexagon and one third of two neighboring hexagons, respectively. A hexagon is assigned a tile if the tile covers two thirds of the hexagon. Since the surface of a "hat" tile is 4/3 the surface of a hexagon, every forth hexagon on average is covered by parts of three different tiles. In this case we assign a zero to this hexagon.
We assign the number "1" to a tile that has the orientation of the dark grey tile in Fig. 1.1 of the paper by Smith. Tiles can only be rotated by multiples of 60 deg and for each counterclockwise rotation of the tile by 60 deg, we increase the count by 1 such that unreflected tiles are assigned the numbers from 1 to 6. Reflected tiles are assigned accordingly the numbers from 7 to 12.
Without loss of generality we place a tile "1" in the central hexagon like in the quoted Fig 1.1 (any other tiling can be transformed into this tiling by rotation or reflection). As next hexagon to be filled we choose the right upper neighbor hexagon. The tiling continues through the surrounding hexagons in counterclockwise direction.
A detailed description of the counting of the tiling options is given in the pdf in the links. a(n) is the number of possible assignments of the first n hexagons such that the plane can be filled at least up to heaxagon 919 (end of ring 17). It would be desirable to demand that the tiling can be continued to infinity, but this is much more difficult to prove.
An open question is: What is the asymptotic behavior of a(n) when n tends to infinity?

Examples

			a(4)=9:  1-0-1-0, 1-0-1-3, 1-0-1-6, 1-0-8-6, 1-2-2-6, 1-2-3-10, 1-2-7-6, 1-2-12-5 and 1-10-12-0 are the nine tiling options for the first four hexagons such that further tiling is possible.
a(7)=18: there are 18 different ways to tile a ring a round the central hexagon.
		

Crossrefs

Extensions

Corrected and extended by Ruediger Jehn, Jun 05 2025

A377018 a(n) is the number of paths of a knight on square a1 to reach a position outside an 8 X 8 chessboard after n steps.

Original entry on oeis.org

6, 4, 32, 108, 880, 4420, 29560, 167068, 1041440, 6128772, 37298680, 222571260, 1343492128, 8055277508, 48487848472, 291196932444, 1751154444320, 10522542700868, 63258161555448, 380185630909692, 2285299322957920, 13735692739737604, 82562224208247576, 496247752160871132
Offset: 1

Author

Ruediger Jehn, Oct 13 2024

Keywords

Comments

a(n)/8^n is the probability that the knight falls off the chess board at step n. The average number of steps it takes the knight to fall off the board is Sum_{n>0} n*a(n)/8^n = A376736(8)/A376737(8) = 101338/51901 or approximately 1.953 steps.
Because of the mirror symmetry of the problem to the board diagonal, all terms are even.

Examples

			a(2) = 4. Starting on square a1 there are 4 paths for a knight to leave the chess board in two steps: b3-z2, b3-z4, c2-b0 and c2-d0 (z being the file left of the a-file).
		

Crossrefs

Cf. A376736, A376737, A376837, A378902 (for a king).

Programs

  • Mathematica
    LinearRecurrence[{3, 27, -29, -162, 42, 276, 16, -96}, {6, 4, 32, 108, 880, 4420, 29560, 167068}, 24] (* Hugo Pfoertner, Oct 16 2024 *)
  • PARI
    Vec(2*(3 - 7*x - 71*x^2 + 39*x^3 + 390*x^4 + 94*x^5 - 484*x^6 - 240*x^7)/(1 - 3*x - 27*x^2 + 29*x^3 + 162*x^4 - 42*x^5 - 276*x^6 - 16*x^7 + 96*x^8) + O(x^30)) \\ Andrew Howroyd, Oct 16 2024

Formula

G.f.: 2*x*(3 - 7*x - 71*x^2 + 39*x^3 + 390*x^4 + 94*x^5 - 484*x^6 - 240*x^7)/(1 - 3*x - 27*x^2 + 29*x^3 + 162*x^4 - 42*x^5 - 276*x^6 - 16*x^7 + 96*x^8). - Andrew Howroyd, Oct 16 2024
a(n) ~ 0.10036158347592796... * 6.01066058303935...^n. - Ruediger Jehn, Nov 06 2024

A376837 a(n) is the number of paths to reach a position outside an 8 X 8 chessboard after n steps, starting in one of the corners, when performing a walk with unit steps on the square lattice.

Original entry on oeis.org

2, 2, 6, 12, 40, 100, 350, 982, 3542, 10738, 39556, 127272, 475332, 1602458, 6030830, 21056830, 79514918, 284645860, 1075801928, 3917238476, 14799350958, 54498514998, 205721183302, 763140403282, 2878050335900, 10726898070952, 40421307665420, 151112554663930, 569043610134622, 2131459901180670
Offset: 1

Author

Ruediger Jehn, Oct 06 2024

Keywords

Comments

a(n)/4^n is the probability that the 1-step rook falls off the chess board at step n. The average number of steps it takes this piece to fall off the board is Sum_{n>0} n*a(n)/4^n = A376606(8)/A376607(8) = 4374/901 or approximately 4.855 steps.
Because of the mirror symmetry of the problem to the board diagonal, all terms are even.

Examples

			a(3) = 6. Starting on square a1 there are 6 paths to leave the chess board: up-up-left, up-down-left, up-down-down, right-right-down, right-left-down and right-left-left.
		

Crossrefs

Cf. A376606, A376607, {A052899}+1 is the analog for the 4X4 chessboard.

Programs

  • Mathematica
    LinearRecurrence[{5, 9, -69, 21, 225, -171, -162, 108, 32, -16}, {2, 2, 6, 12, 40, 100, 350, 982, 3542, 10738}, 30] (* Hugo Pfoertner, Oct 16 2024 *)
  • PARI
    Vec(2*(1 - 4*x - 11*x^2 + 51*x^3 + 11*x^4 - 143*x^5 + 42*x^6 + 78*x^7 - 12*x^8 - 8*x^9)/((1 - 2*x)*(1 - 3*x^2 + x^3)*(1 - 3*x + x^3)*(1 - 12*x^2 - 8*x^3)) + O(x^30)) \\ Andrew Howroyd, Oct 16 2024

Formula

a(n) == 0 (mod 2).
G.f.: 2*x*(1 - 4*x - 11*x^2 + 51*x^3 + 11*x^4 - 143*x^5 + 42*x^6 + 78*x^7 - 12*x^8 - 8*x^9)/((1 - 2*x)*(1 - 3*x^2 + x^3)*(1 - 3*x + x^3)*(1 - 12*x^2 - 8*x^3)). - Andrew Howroyd, Oct 16 2024