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: Yancheng Lu

Yancheng Lu's wiki page.

Yancheng Lu has authored 4 sequences.

A336233 a(n) is the player who has highest winning probability in the "Random Josephus Game" with n players.

Original entry on oeis.org

1, 1, 3, 1, 2, 3, 4, 6, 8, 1, 1, 2, 3, 4, 5, 6, 8, 9, 11, 12, 14, 16, 17, 19, 21, 23, 25, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 34, 36, 37, 39, 41, 42, 44, 46, 47, 49, 51, 53, 55, 56, 58, 60, 62, 64, 66, 68
Offset: 1

Author

Yancheng Lu, Jul 13 2020

Keywords

Comments

The "Random Josephus Game" is a random variety of Josephus problem. Here, there are n players arranged in a loop labeled 1,2,...,n, and on every player's turn, he kills one of the players except himself equiprobably randomly and then gives the turn to the next living player in order of the loop, started by player 1. The winner is the last survivor.
Note that in the case with 3 players, both player 2 and player 3 have a winning probability of 1/2, and a(3) can be either 2 or 3.

Examples

			For example, a "Random Josephus Game" with 4 players has 6 possible results, the probability of each is 1/6 respectively:
1) Player 1 kills player 2 and gives the turn to player 3. Then player 3 kills player 4 and gives the turn to player 1. Finally, player 1 kills player 3 and becomes the winner.
2) Player 1 kills player 2 and gives the turn to player 3. Then player 3 kills player 1 and gives the turn to player 4. Finally, player 4 kills player 3 and becomes the winner.
3) Player 1 kills player 3 and gives the turn to player 2. Then player 2 kills player 4 and gives the turn to player 1. Finally, player 1 kills player 2 and becomes the winner.
4) Player 1 kills player 3 and gives the turn to player 2. Then player 2 kills player 1 and gives the turn to player 4. Finally, player 4 kills player 2 and becomes the winner.
5) Player 1 kills player 4 and gives the turn to player 2. Then player 2 kills player 3 and gives the turn to player 1. Finally, player 1 kills player 2 and become the winner.
6) Player 1 kills player 4 and gives the turn to player 2. Then player 2 kills player 1 and gives the turn to player 3. Finally, player 3 kills player 2 and becomes the winner.
One can see, player 1 wins in three of the cases above, while player 3 wins in one of those, player 4 wins in two, and Player 2 wins in none. Thus, the winning probability of the four players are 1/2, 0, 1/6 and 1/3 respectively. Therefore a(4)=1.
		

Crossrefs

Programs

  • Mathematica
    table1 = NestList[
      Prepend[(Range[0, Length[#] - 1] Prepend[Most[#], 0] +
           Range[Length[#] - 1, 0, -1] #)/Length[#], Last[#]] &, {1.},
      1000];
    First[Ordering[#, -1]] & /@ table1

A334276 a(n) = prime(A003593(n)).

Original entry on oeis.org

2, 5, 11, 23, 47, 97, 103, 197, 379, 419, 691, 761, 1427, 1543, 2557, 2789, 4637, 5039, 5519, 9049, 9851, 16103, 17609, 19289, 28687, 31319, 34123, 55381, 60167, 65687, 97499, 106243, 115757, 171529, 186437, 202987, 220861, 326537, 354979, 386501, 570643, 620201, 674837
Offset: 1

Author

Yancheng Lu, May 20 2020

Keywords

Comments

The first six terms agree with A055496.

Crossrefs

Programs

  • Mathematica
    fQ[n_]:=PowerMod[15,n,n]==0;
    Prime[Select[Range[1000000],fQ]]

A307092 a(n) is the minimum number of iterations of the form x -> x + x^j (where j is a nonnegative integer and need not be identical in each iteration) required to reach n starting from 1.

Original entry on oeis.org

0, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, 4, 5, 2, 3, 3, 4, 4, 5, 4, 5, 5, 6, 5, 6, 3, 4, 5, 6, 2, 3, 3, 4, 4, 5, 4, 5, 3, 4, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, 4, 5, 6, 7, 4, 5, 5, 6, 6, 7, 2, 3, 3, 4, 4, 5, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 3, 4, 5, 6, 6, 7, 5, 6, 7, 8, 8, 9, 6, 7, 7, 8, 7
Offset: 1

Author

Yancheng Lu, Mar 24 2019

Keywords

Comments

The background of this sequence is an "execute-summon" problem in Minecraft command system ver. 1.13+. In Minecraft v1.13+, if you just summon an entity using the "summon" command, you get one more. However, when you combine the "summon" command with nested "execute" commands that target all entities, you will get x^j more entities, where x is the number of entities before the command and j is the number of times the command is nested. To obtain a given number of entities, we are interested in the minimal number of iterations using such commands. The minimal number of iterations to get n is the n-th term of this sequence. [Clarified by Peter Kagey, Aug 24 2019]
From Peter Kagey and Chris Quisling, Aug 22 2019: (Start)
In Minecraft there are several commands, such as /summon, which summons a creature, and /execute which can be combined with other commands to behave like a for-loop.
For example, running "/summon minecraft:cat" places a cat into the game, and running "/execute at @e run summon minecraft:cat" places one cat into the game for every creature in the game.
If there are x creatures in the game, nesting the "execute" command k times has the effect of creating x^k new creatures, resulting in a total of x + x^k creatures.
For example, running "/execute at @e run execute at @e run summon minecraft:cat" places x^2 new creatures into the game.
(End)
a(n) <= 2*A000523(n), as we can always get from floor(n/2) to n by applying the map(s) x -> x + x (and x -> x + 1 if n is odd). - Ely Golden, Aug 19 2020

Examples

			For n = 43, a(43) = 4 because we can reach 43 by the four iterations below, but not in less iterations:
- 1 -> 2 by setting j=0, 1 + 1^0 = 2,
- 2 -> 6 by setting j=2, 2 + 2^2 = 6,
- 6 -> 42 by setting j=2, 6 + 6^2 = 42,
- 42 -> 43 by setting j=0, 42 + 42^0 = 43.
From _Peter Kagey_, Aug 22 2019: (Start)
So if there is exactly one creature in the game, running the following four commands will result in 43 creatures in the game:
/summon minecraft:cat
/execute at @e run execute at @e run summon minecraft:cat
/execute at @e run execute at @e run summon minecraft:cat
/summon minecraft:cat
Which have 0, 2, 2, and 0 nested "execute" commands respectively, and four is the fewest number of commands that can be run to create exactly 43 creatures in the game.
(End)
		

Crossrefs

Programs

  • Mathematica
    (* To get more terms of the sequence, increase terms, maxa and maxx, and then set maxi=trunc(lb(maxx)) *)
    maxi=16; maxx=65536; maxa=10; terms=100;
    a = NestList[
      Function[list,
       DeleteDuplicates[
        Join[list,
         Flatten[Table[If[# + #^i <= maxx, # + #^i, 1], {i, 0, maxi}] & /@
           list]]]], {1}, maxa];
    b = Prepend[Table[Complement[a[[i + 1]], a[[i]]], {i, Length[a] - 1}],
       First[a]];
    c = SparseArray[
       Flatten[b] ->
        Flatten[Table[
          ConstantArray[i, Length[b[[i]]]], {i, Length[b]}]]] // Normal;
    Take[c, terms] - 1

A307074 a(n) is the smallest k such that A307092(k) = n.

Original entry on oeis.org

1, 2, 3, 5, 9, 15, 27, 47, 55, 95, 187, 191, 375, 415, 751, 831, 1503, 1663, 3007, 3327, 6639, 7039, 13279, 14079, 26559, 28159, 53119, 56319, 106239, 112639, 212479, 225279, 424959, 450559, 849919, 901119, 1699839, 1802239, 3399679, 3604479, 6799359, 7208959
Offset: 0

Author

Yancheng Lu, Mar 22 2019

Keywords

Comments

a(n) is the smallest number k such that exactly n iterations of the mapping x -> x + x^j, where j is a nonnegative integer, are required to reach x=k from x=1 (the j's in each iteration need not be identical).

Examples

			n  |a(n)| maps                         | exponents
---+----+------------------------------+------------
1  | 1  | 1                            | []
2  | 2  | 1 -> 2                       | [0]
3  | 3  | 1 -> 2 -> 3                  | [0,0]
4  | 5  | 1 -> 2 -> 4 -> 5             | [0,1,0]
5  | 9  | 1 -> 2 -> 4 -> 8 -> 9        | [0,1,1,0]
6  | 15 | 1 -> 2 -> 6 -> 7 -> 14 -> 15 | [0,2,0,1,0]
		

Crossrefs

Cf. A307092.

Programs

  • Mathematica
    (* To get more terms of the sequence, increase terms and maxx,
       and then set maxi=trunc(lb(maxx)) *)
    maxi=16;maxx=65536;terms=10;
    a = NestList[
      Function[list,
       DeleteDuplicates[
        Join[list,
         Flatten[Table[If[# + #^i <= maxx, # + #^i, 1], {i, 0, maxi}] & /@
           list]]]], {1}, terms];
    b = Prepend[Table[Complement[a[[i + 1]], a[[i]]], {i, Length[a] - 1}],
       First[a]];
    Min /@ b