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: Tanya Khovanova

Tanya Khovanova's wiki page.

Tanya Khovanova has authored 482 sequences. Here are the ten most recent ones:

A386305 Numbers of people such that the first 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.

Original entry on oeis.org

1, 2, 3, 18, 22, 171, 195, 234, 1262, 2136, 6040, 42545, 353067, 1332099, 1447753, 2789475, 3635021, 7857445, 9224024, 17128159, 27666710, 29279638
Offset: 1

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Aug 20 2025

Keywords

Comments

This sequence can also be described in terms of "AP dealing", in which one deals a deck of N cards into a new deck by moving one card to the bottom, dealing out the next card on top of the new deck, moving two cards to the bottom, etc. This sequence consists of all the deck sizes such that the top card remains the same after AP dealing.
Numbers k such that A291317(k) = 1.

Examples

			Suppose there are 5 people in a circle. We start with skipping one person and eliminating the next (person number 2). The leftover people are 3,4,5,1 in order. Then we skip two people and eliminate person number 5. The leftover people are 1,3,4 in order. Then we skip three people and person number 1 is eliminated. The leftover people are 3,4 in order. Then we skip four people and eliminate person number 3. Person 4 is freed. As person 1 is not freed, 5 is NOT in this sequence.
		

Crossrefs

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) == 1])

Extensions

a(20)-a(22) from Jinyuan Wang, Aug 31 2025

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.

Original entry on oeis.org

1, 7, 10, 12, 21, 25, 28, 235, 822, 24886, 99607, 101497, 107716, 5756103, 55480598
Offset: 1

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Aug 20 2025

Keywords

Comments

This sequence can also be described in terms of "AP dealing", in which one deals a deck of N cards into a new deck by moving one card to the bottom, dealing out the next card on top of the new deck, moving two cards to the bottom, etc. This sequence consists of all the deck sizes such that the bottom card of the deck moves to the top after AP dealing.
Numbers k such that A291317(k) = k.

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.
		

Crossrefs

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

A386641 Triangle read by row: T(n,k) is the number of the k-th eliminated person in a variant of the Josephus problem in which one person is skipped, then one is eliminated, then two people are skipped, then the next person is eliminated and so on.

Original entry on oeis.org

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

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Jul 27 2025

Keywords

Comments

The numbers 1 through n are arranged in a circle. The process starts at position 1. Initially, the first number is skipped, and the next number is eliminated. Then, two numbers are skipped, and the next one is eliminated. Then, three numbers are skipped, and so on. The process repeats until no numbers remain.
This variation of the Josephus problem can equivalently be described in terms of the AP card dealing, where the cards of a deck are dealt by alternately x cards from the top "under", and then dealing the next card "down". Here, x starts as 1, and is increased by 1 with every dealt card. In particular, T(n,k) is the k-th card dealt in the AP dealing if the deck begins in order 1,2,3,...,n.
The freed person is A291317(n).

Examples

			Consider 4 people in a circle. Initially, person number 1 is skipped, and person 2 is eliminated. The remaining people are now in order 3, 4, 1. Then, two people are skipped, and person 1 is eliminated. The remaining people are in order 3, 4. Now, three people are skipped and person 4 is eliminated. Person 3 is eliminated last. Thus, the fourth row of the triangle is 2,1,4,3.
The triangle begins as follows:
  1;
  2, 1;
  2, 3, 1;
  2, 1, 4, 3;
  2, 5, 1, 3, 4;
  2, 5, 4, 1, 6, 3;
  2, 5, 3, 4, 1, 6, 7;
  2, 5, 1, 8, 4, 6, 3, 7;
  2, 5, 9, 7, 8, 4, 1, 3, 6;
		

Crossrefs

Cf. A321298 (classical elimination process).

Programs

  • Python
    def row(n):
      c, i, J = 1, 0, list(range(1, n+1))
      output = []
      while len(J) > 1:
        i = (i + c) % len(J)
        q = J.pop(i)
        output.append(q)
        c = c + 1
      output.append(J[0])
      return output
    print([e for n in range(1,15) for e in row(n)])

Formula

T(n,k) = A000096(k), when n >= A000096(k).

A386639 Triangle T(n,k) read by rows, where row n is a permutation of the numbers 1 through n, such that if a deck of n cards is prepared in this order, and the AP dealing is used, then the resulting cards will be dealt in increasing order.

Original entry on oeis.org

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

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Jul 27 2025

Keywords

Comments

The AP dealing is a dealing pattern where x cards are placed at the bottom of the deck, and then the next card is dealt. The number of cards x placed at the bottom changes with every dealt card according to the arithmetic progression 1, 2, 3, and so on. This pattern repeats until all of the cards have been dealt.
This card dealing can equivalently be seen as a variation on the Josephus problem, where one person is skipped, then the next person is eliminated, then two people are skipped and one person is eliminated, then three people are skipped, and so on. T(n,k) is the order of elimination of the k-th person in the Josephus problem. Equivalently, each row of T is the inverse permutation of the corresponding row of the Josephus triangle A386641, i.e., A386641(n,T(n,k)) = k.
The total number of moves for row n is A000096.
The first column is A386643(n), the order of elimination of the first person in the Josephus problem.
The index of the largest number in row n is A291317(n), corresponding to the index of the freed person in the corresponding Josephus problem.

Examples

			Consider a deck of four cards arranged in the order 2,1,4,3. We put one card under and deal the next card, which is card number 1. Now the deck is ordered 4,3,2. We place 2 cards under and deal the next one, which is card number 2. Now the deck is 4,3. Again, placing 3 cards under and dealing the next, we will deal card number 3, leaving card number 4 to be dealt last. The dealt cards are in order. Thus, the fourth row of the triangle is 2,1,4,3.
The triangle begins as follows:
  1;
  2, 1;
  3, 1, 2;
  2, 1, 4, 3;
  3, 1, 4, 5, 2;
  4, 1, 6, 3, 2, 5;
  5, 1, 3, 4, 2, 6, 7;
  3, 1, 7, 5, 2, 6, 8, 4;
  7, 1, 8, 6, 2, 9, 4, 5, 3;
		

Crossrefs

Cf. A378635 (classical elimination process).

Formula

T(n,A000096(k)) = k, for A000096(k) <= n.

A386643 Elimination order of the first person in a variation 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.

Original entry on oeis.org

1, 2, 3, 2, 3, 4, 5, 3, 7, 9, 5, 7, 4, 10, 6, 13, 16, 18, 5, 17, 10, 22, 22, 8, 17, 6, 21, 15, 27, 18, 16, 18, 23, 7, 12, 35, 35, 36, 28, 13, 15, 37, 8, 21, 30, 16, 37, 26, 30, 41, 23, 19, 9, 28, 33, 13, 28, 44, 50, 35, 60, 58, 53, 10, 47, 61, 41, 37, 26, 34, 70, 15, 66, 34, 50, 11, 55, 19, 70, 70
Offset: 1

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Jul 27 2025

Keywords

Examples

			Consider 4 people in a circle. Initially, person number 1 is skipped, and person 2 is eliminated. The remaining people are now in order 3, 4, 1. Then, two people are skipped, and person 1 is eliminated, implying that the order of elimination of the first person is 2: a(4) = 2.
		

Crossrefs

The first column of triangle A386639.

A385513 The numbers of people in the "SpellUnder-Down" variant of the Josephus problem such that the last person is freed.

Original entry on oeis.org

1, 6, 7, 105, 181, 215, 821, 1907, 3176, 23388, 55058
Offset: 1

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Jul 01 2025

Keywords

Comments

In SpellUnder-Down dealing, we spell the number of the next card, putting a card under for each letter in the number, then we deal the next card. So we start with putting 3 cards under, for O-N-E, then deal, then 3 under for T-W-O, then deal, then 5 under for T-H-R-E-E, then deal. The dealing sequence is highly irregular because it depends on English spelling. The dealing pattern starts: UUUDUUUDUUUUUD. In the corresponding Josephus problem, we skip the next person for each under dealing, and eliminate the next person for each down dealing.
This sequence can be used in magic tricks with the SpellUnder-Down dealing pattern. The deck sizes in this sequence guarantee that after the dealing, the last card dealt is the one that was initially on the bottom.
The classical Josephus problem corresponds to under-down dealing. In this case, the last person is freed when the number of people is a power of 2 minus 1.
A naive probabilistic argument predicts the probability that A380204(k) = k is 1/k and expects this sequence to be infinite and distributed roughly as A002387. - Michael S. Branicky, Jul 24 2025

Examples

			Suppose there are 5 people in a circle. We start with skipping three people for O-N-E. After three people are skipped, the person number 4 is eliminated. The leftover people are 5,1,2,3 in order. Then we skip three people for T-W-O. The person number 3 eliminated, and the leftover people are 5,1,2 in order. Then we skip 5 people for T-H-R-E-E, and person number 2 is eliminated, and the leftover people are 5,1 in order. Then we skip four people for F-O-U-R. person number 5 is eliminated. Person 1 is freed. As person 1 is not last, 5 is NOT in this sequence.
		

Formula

{k | A380204(k) = k}. - Michael S. Branicky, Jul 24 2025

Extensions

a(10)-a(11) from Michael S. Branicky, Jul 24 2025

A384774 Elimination order of the first person in a variation of the Josephus problem in which first three people are skipped, then one is eliminated, repeating until all n people are eliminated.

Original entry on oeis.org

1, 2, 1, 2, 5, 3, 2, 5, 9, 8, 3, 12, 6, 10, 4, 16, 12, 16, 5, 9, 20, 10, 6, 22, 21, 23, 7, 27, 13, 21, 8, 30, 23, 20, 9, 16, 31, 17, 10, 31, 24, 35, 11, 34, 20, 27, 12, 28, 34, 49, 13, 23, 31, 24, 14, 49, 55, 34, 15, 35, 27, 59, 16, 44, 38, 60, 17, 30, 53, 31
Offset: 1

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Jun 09 2025

Keywords

Comments

a(4k-1) = k
a(n) = A384770(n,1).

Examples

			Consider n = 4 people. The first person eliminated is number 4. This leaves the remaining people in order 1, 2, 3. On the second step, we eliminate person number 1, implying that the order of elimination of the first person is 2: a(4) = 2.
		

Crossrefs

Cf. First column of A384770.

Programs

  • Maple
    A384774 := proc(n::integer)
        local plist,eli,skip,ptr ;
        plist := [seq(i,i=1..n)] ;
        eli :=1 ;
        skip := 3;
        ptr := 0 ;
        while true do
            ptr := modp(ptr+skip,nops(plist)) ;
            if op(ptr+1,plist) = 1 then
                return eli ;
            end if;
            plist := subsop(ptr+1=NULL,plist) ;
            eli := eli+1 ;
        end do:
    end proc:
    seq(A384774(n),n=1..100) ; # R. J. Mathar, Jul 30 2025
  • Python
    def a(n):
        c, i, J = 1, 0, list(range(1, n+1))
        while len(J) > 0:
            i = (i + 3)%len(J)
            q = J.pop(i)
            if q == 1: return c
            c = c+1
    print([a(n) for n in range(1, 71)])

A384772 Triangle read by row: T(n,k) is the number of the k-th eliminated person in a variant of the Josephus problem in which first three people are skipped, then one is eliminated, repeating until all n people are eliminated.

Original entry on oeis.org

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

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Jun 09 2025

Keywords

Comments

The numbers 1 through n are arranged in a circle. A pointer starts at position 1. With each turn, the pointer skips three numbers and the next number is eliminated. The process repeats until no numbers remain. This sequence is a concatenation of the rows of the triangle T, where T(n, k) is the elimination order of the k-th number in a circle of n numbers.
This variation of the Josephus problem can equivalently be described in terms of under-under-under-down card dealing, where the cards of a deck are dealt by alternately cycling three cards from the top "under", and then dealing the next card "down". In particular, T(n,k) is the k-th card dealt in under-under-under-down dealing if the deck begins in order 1,2,3,...,n.

Examples

			Consider 4 people in a circle. Initially, people numbered 1, 2, and 3 are skipped, and person 4 is eliminated. The remaining people are now in order 1, 2, 3. Then all three are skipped and person 1 is eliminated. The remaining people are in order 2, 3. Now, we skip over 2, 3, 2 and eliminate person 3. Person 2 is eliminated last. Thus, the fourth row of the triangle is 4, 1, 3, 2.
The triangle begins as follows:
  1;
  2, 1;
  1, 3, 2;
  4, 1, 3, 2;
  4, 3, 5, 2, 1;
  4, 2, 1, 3, 6, 5;
  4, 1, 6, 5, 7, 3, 2;
  4, 8, 5, 2, 1, 3, 7, 6;
  4, 8, 3, 9, 6, 5, 7, 2, 1
		

Programs

  • Python
    def row(n):
        i, J, out = 0, list(range(1, n+1)), []
        while len(J) > 0:
            i = (i + 3)%len(J)
            out.append(J.pop(i))
        return out
    print([e for n in range(1, 14) for e in row(n)])

A384770 Triangle T(n,k) read by rows, where row n is a permutation of the numbers 1 through n, such that if a deck of n cards is prepared in this order, and under-under-under-down dealing is used, then the resulting cards will be dealt in increasing order.

Original entry on oeis.org

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

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Jun 09 2025

Keywords

Comments

Under-under-under-down dealing is a dealing pattern where the top three cards are placed at the bottom of the deck, and then the next card is dealt. This pattern repeats until all of the cards have been dealt.
This card dealing can equivalently be seen as a variation on the Josephus problem where every 4th person is eliminated. T(n,k) is the number of eliminations in the Josephus problem that occur before the k-th person is eliminated. Equivalently, each row of T is the inverse permutation of the corresponding row of the Josephus triangle A384772, i.e. A384772(n,T(n,k)) = k.
The total number of moves for row n is 4n.
The first column is A384774(n), the order of elimination of the first person in the Josephus problem.
The index of the largest number in row n is A088333(n), corresponding to the index of the freed person in the corresponding Josephus problem.
T(n,4j) = j, for 4j <= n.

Examples

			Consider a deck of four cards arranged in the order 2,4,3,1. If we put the top 3 cards under and deal the next card, we will deal card number 1. Now the deck is ordered 2,4,3. If we place 3 cards under and deal the next one, we will deal card number 2, and be left with cards 4,3. Again placing 3 cards under and dealing the next, we will deal card number 3, leaving card number 4 to be dealt last. The dealt cards are in order. Thus, the fourth row of the triangle is 2,4,3,1.
The triangle begins as follows:
 1
 2, 1;
 1, 3, 2;
 2, 4, 3, 1;
 5, 4, 2, 1, 3;
 3, 2, 4, 1, 6, 5;
 2, 7, 6, 1, 4, 3, 5;
 5, 4, 6, 1, 3, 8, 7, 2;
 9, 8, 3, 1, 6, 5, 7, 2, 4
		

Programs

  • Python
    def row(n):
        i, J, out = 0, list(range(1, n+1)), []
        while len(J) > 1:
            i = (i + 3)%len(J)
            out.append(J.pop(i))
        out += [J[0]]
        return [out.index(j)+1 for j in list(range(1, n+1))]
    print([e for n in range(1, 14) for e in row(n)])

Formula

T(n, 4) = 1 for n >= 4
T(n, k) = T(n-1, k-4 mod n) + 1 if k !== 4 (mod n).

A385328 The number of people in a variation of the Josephus problem when the first person is freed and the elimination process is to skip the number of people equaling the number of letters in consecutive numbers, then eliminate the next person.

Original entry on oeis.org

1, 2, 5, 26, 50, 82, 857, 1114, 3340, 3733, 3777, 11023, 12960, 17992, 47253, 329414, 367572, 382265
Offset: 1

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Jun 25 2025, Jun 25 2025, Jul 06 2025

Keywords

Comments

This sequence uses the US spelling. [Specifically, A005589. - Michael S. Branicky, Jul 23 2025]
This sequence can be used in magic tricks with SpellUnderDown dealing pattern. The first three people are skipped, corresponding to three letters in O-N-E, and the next person is eliminated. Then, three people are skipped corresponding to three letters in T-W-O, and the next person is eliminated. Then, 5 people are skipped, corresponding to 5 letters in T-H-R-E-E.
The deck sizes in this sequence guarantee that after the dealing, the last card is the one that was initially on top.
A naive probabilistic argument predicts the probability that A380204(k) = 1 is 1/k and expects this sequence to be infinite and distributed roughly as A002387. - Michael S. Branicky, Jul 23 2025

Examples

			Suppose there are 5 people in a circle. After three people are skipped (for O-N-E), the person number 4 is eliminated. The leftover people are 5,1,2,3 in order. Then three people are skipped (for T-W-O), and person number 3 is eliminated. The leftover people are 5,1,2 in order. Then 5 people are skipped (for T-H-R-E-E), and person 2 is eliminated. The leftover people are 5,1 in order. Then 4 people are skipped (for F-O-U-R), and person number 5 is eliminated. Person 1 is freed. Thus, 5 is in this sequence.
		

Formula

{k | A380204(k) = 1}. - Michael S. Branicky, Jul 23 2025

Extensions

a(15)-a(18) from Michael S. Branicky, Jul 23 2025