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-10 of 12 results. Next

A380204 A version of the Josephus problem: a(n) is the surviving integer under the spelling version of the elimination process.

Original entry on oeis.org

1, 1, 2, 2, 1, 6, 7, 3, 5, 3, 5, 6, 10, 9, 2, 13, 3, 16, 10, 2, 15, 6, 15, 6, 21, 1, 7, 23, 26, 6, 20, 12, 27, 29, 7, 2, 36, 11, 6, 7, 32, 6, 32, 43, 10, 31, 7, 5, 42, 1, 17, 48, 7, 31, 53, 25, 42, 43, 29, 39, 51, 25, 43, 7, 26, 59, 15, 10, 60, 69, 13, 57, 54, 66, 57, 30, 9, 35, 64, 9, 65, 1, 15, 3, 79, 47, 86, 7
Offset: 1

Views

Author

Tanya Khovanova and the MIT PRIMES STEP junior group, Jan 16 2025

Keywords

Comments

Arrange n people numbered 1, 2, 3, ..., n in a circle, increasing clockwise. Starting with the person numbered 1, spell the letters of O-N-E, moving one person clockwise for each letter. Once you are done, eliminate the next person. Then, spell the letters of T-W-O; in other words, skip three people and eliminate the next person. Following this, spell the letters of T-H-R-E-E; in other words, skip five people and eliminate the next person. Continue until one person remains. The number of this person is a(n).

Examples

			Consider n = 4 people. The first person eliminated is number 4. This leaves the remaining people in the order 1, 2, 3. The second person eliminated is number 1; the people left are in the order 2, 3. The next person eliminated is numbered 3, leaving only the person numbered 2. Thus a(4) = 2.
		

Crossrefs

Programs

  • Python
    from num2words import num2words as n2w
    def f(n): return sum(1 for c in n2w(n).replace(" and", "") if c.isalpha())
    def a(n):
        c, i, J = 1, 0, list(range(1, n+1))
        while len(J) > 1:
            i = (i + f(c))%len(J)
            q = J.pop(i)
            c = c+1
        return J[0]
    print([a(n) for n in range(1, 89)]) # Michael S. Branicky, Jan 26 2025

Extensions

Terms a(22) and beyond corrected by Michael S. Branicky, Feb 15 2025

A380246 Elimination order of the first person in a variation of the Josephus problem, where the number of skipped people correspond to the number of letters in consecutive numbers, called SpellUnder-Down.

Original entry on oeis.org

1, 2, 1, 2, 5, 4, 2, 5, 6, 4, 6, 10, 3, 12, 6, 8, 15, 4, 13, 19, 14, 17, 5, 22, 18, 26, 6, 20, 13, 17, 19, 23, 7, 25, 21, 31, 22, 32, 8, 31, 38, 20, 29, 9, 27, 18, 43, 10, 15, 50, 37, 20, 16, 41, 11, 21, 39, 36, 34, 32, 29, 12, 36, 50, 27, 53, 35, 19, 45, 67, 13, 20, 70, 59, 74, 26, 21, 40, 65, 14, 49, 82, 33, 43, 28, 34, 53, 15
Offset: 1

Views

Author

Tanya Khovanova and the MIT PRIMES STEP junior group, Jan 17 2025

Keywords

Comments

Arrange n people numbered 1,2,3,...,n in a circle, increasing clockwise. Starting with the person numbered 1, spell the letters of O-N-E, moving one person clockwise for each letter. Once you are done, eliminate the next person. Then, spell the letters of T-W-O; in other words, skip three people and eliminate the next person. Following this, spell the letters of T-H-R-E-E; in other words, skip five people and eliminate the next person. Continue until one person remains. a(n) is the order of elimination of the first person.

Examples

			Consider n = 4 people. The first person eliminated is number 4. This leaves the remaining people in order 1, 2, 3. The second person eliminated is number 1. Thus, person number 1 is eliminated in the second round, implying that a(4) = 2.
		

Crossrefs

Programs

  • Python
    from num2words import num2words as n2w
    def spell(n):
        return sum(1 for c in n2w(n).replace(" and", "").replace(" ", "").replace(chr(44), "").replace("-", ""))
    def nthRow(n):
        l = []
        for i in range(0,n):
            l.append(0)
        zp = 0
        for j in range(1,n+1):
            zc = 0
            while zc <= spell(j):
                if l[zp] == 0:
                    zc += 1
                zp += 1
                zp = zp % n
            l[zp-1] = str(j)
        return l
    l = []
    for i in range(1,89):
        l += [nthRow(i)[0]]
    print(l)
    
  • Python
    from num2words import num2words as n2w
    def f(n): return sum(1 for c in n2w(n).replace(" and", "") if c.isalpha())
    def a(n):
        c, i, J = 1, 0, list(range(1, n+1))
        while len(J) > 0:
            i = (i + f(c))%len(J)
            q = J.pop(i)
            if q == 1: return c
            c = c+1
    print([a(n) for n in range(1, 89)]) # Michael S. Branicky, Feb 15 2025

A380202 Number of card moves to deal n cards using the SpellUnder-Down dealing.

Original entry on oeis.org

4, 8, 14, 19, 24, 28, 34, 40, 45, 49, 56, 63, 72, 81, 89, 97, 107, 116, 125, 136, 146, 156, 168, 179, 190, 200, 212, 224, 235, 246, 256, 266, 278, 289, 300, 310, 322, 334, 345, 355, 364, 373, 384, 394, 404, 413, 424, 435, 445, 455, 464, 473, 484, 494, 504, 513, 524, 535, 545, 555, 564, 573, 584, 594, 604, 613, 624, 635, 645
Offset: 1

Views

Author

Tanya Khovanova and the MIT PRIMES STEP junior group, Jan 16 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.

Examples

			The dealing pattern to deal three cards is UUUDUUUDUUUUUD. It contains 14 letters, thus, a(3) = 14.
		

Crossrefs

Formula

a(n) = A067278(n) + n.

A380247 Triangle read by rows: T(n,k) is the number of the k-th eliminated person in the variation of the Josephus elimination process for n people, where the number of people skipped correspond to the number of letters in the next number in English alphabet.

Original entry on oeis.org

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

Views

Author

Tanya Khovanova and the MIT PRIMES STEP junior group, Jan 17 2025

Keywords

Comments

In this variation of the Josephus elimination process, the numbers 1 through n are arranged in a circle. A pointer starts at position 1. Then three people are skipped because number O-N-E has three letters, then the next person is eliminated. Next, three people are skipped because T-W-O has three letters, and the next person is eliminated. Then, five people are skipped because T-H-R-E-E has five letters, and so on. This repeats until no numbers remain. This sequence represents the triangle T(n, k), where n is the number of people in the circle, and T(n, k) is the elimination order of the k-th person in the circle.
In rows 4 and after, the first number is 4. In rows 8 and after, the second number is 8. In rows 14 and after, the third number is 14. In the limit the numbers form sequence A380202.

Examples

			Triangle begins:
  1;
  2, 1;
  1, 3, 2;
  4, 1, 3, 2;
  4, 3, 2, 5, 1;
  4, 2, 5, 1, 3, 6;
  4, 1, 2, 3, 6, 5, 7;
  ...
For n = 4 suppose four people are arranged in a circle corresponding to the fourth row of the triangle. Three people are skipped for each letter in O-N-E; then the 4th person is eliminated. This means the row starts with 4. The next three people are skipped, and the person eliminated is number 1. Thus, the next element in the row is 1. Then, 5 people are skipped, and the next person eliminated is number 3. Similarly, the last person eliminated is number 2. Thus, the fourth row of this triangle is 4, 1, 3, 2.
		

Crossrefs

Programs

  • Python
    from num2words import num2words as n2w
    def spell(n):
        return sum(1 for c in n2w(n).replace(" and", "").replace(" ", "").replace(chr(44), "").replace("-", ""))
    def inverse_permutation(p):
        inv = [0] * len(p)
        for i, x in enumerate(p):
            inv[x-1] = i +1
        return inv
    def nthRow(n):
        l = []
        for i in range(0,n):
            l.append(0)
        zp = 0
        for j in range(1,n+1):
            zc = 0
            while zc <= spell(j):
                if l[zp] == 0:
                    zc += 1
                zp += 1
                zp = zp % n
            l[zp-1] = j
        return l
    l = []
    for i in range(1,15):
        l += inverse_permutation(nthRow(i))
    print(l)
    
  • Python
    from num2words import num2words as n2w
    def f(n): return sum(1 for c in n2w(n).replace(" and", "") if c.isalpha())
    def row(n):
        c, i, J = 1, 0, list(range(1, n+1))
        out = []
        while len(J) > 1:
            i = (i + f(c))%len(J)
            q = J.pop(i)
            out.append(q)
            c = c+1
        out.append(J[0])
        return out
    print([e for n in range(1, 15) for e in row(n)]) # Michael S. Branicky, Feb 15 2025

A380248 The order of the 13 cards of one suit such that after the SpellUnder-Down deal the cards are in order; a(n) is the n-th card in the deck.

Original entry on oeis.org

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

Views

Author

Tanya Khovanova and the MIT PRIMES STEP junior group, Jan 17 2025

Keywords

Comments

Number 1 corresponds to ace, 11 to jack, 12 to queen, 13 to king.
In the SpellUnder-Down deal, we spell the next card, putting a card under for each letter in the name, then we deal the next card. So we start with putting 3 cards under for A-C-E, then deal, then 3 cards under for T-W-O, then deal, then 5 cards 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.
The sequence is a permutation of 13 numbers.

Examples

			The first card dealt is the fourth card in the deck, thus, the fourth card must be an ace.
		

Crossrefs

A381114 Triangle read by rows: T(n,k) is the number of the k-th eliminated person in a variation of the Josephus elimination process for n people, where the number of people skipped is equal to the number of letters in the previous number's English name.

Original entry on oeis.org

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

Views

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Feb 14 2025

Keywords

Comments

In this variation of the Josephus elimination process, people numbered 1 through n are arranged in a circle. A pointer starts at person 1. Person 1 is eliminated, then three people are skipped because the number O-N-E has three letters. Then, the next person is eliminated. Next, three people are skipped because T-W-O has three letters, and the next person is eliminated. Then, five people are skipped because T-H-R-E-E has five letters, and so on. This repeats until no people remain. This sequence represents the triangle T(n, k), the order of elimination for the person numbered k in a circle of n people.
Every entry of the first column is 1.
In rows 5 and after, the second number is 5. In rows 9 and after, the third number is 9. In rows 15 and after, the fourth number is 15. In the limit, the numbers in a row form sequence A381128(k).

Examples

			Triangle begins:
 1;
 1, 2;
 1, 3, 2;
 1, 2, 4, 3;
 1, 5, 2, 4, 3;
 1, 5, 4, 3, 6, 2;
 1, 5, 3, 6, 2, 4, 7;
 ...
For n = 4, suppose four people are arranged in a circle. The first person is eliminated, then three people are skipped because O-N-E has three letters. The leftover people are now in order 2,3,4. Then, the next person (numbered 2) is eliminated. The leftover people are now ordered 3,4. The next three people are skipped, so the person eliminated is number 4. Then, 5 people are skipped, and the next person eliminated is number 3. Thus, the fourth row of the triangle is 1,2,4,3.
		

Crossrefs

Programs

  • Python
    from num2words import num2words as n2w
    def f(n): return sum(1 for c in n2w(n).replace(" and", "") if c.isalpha())
    def row(n):
        c, i, J, out = 1, 0, list(range(1, n+1)), []
        while len(J) > 1:
            q = J.pop(i)
            out.append(q)
            i = (i + f(c))%len(J)
            c = c+1
        return out + [J[0]]
    print([e for n in range(1, 14) for e in row(n)]) # Michael S. Branicky, Feb 16 2025

A381127 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 Down-SpellUnder dealing is used, then the resulting cards will be dealt in increasing order.

Original entry on oeis.org

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

Views

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Feb 14 2025

Keywords

Comments

In Down-SpellUnder dealing, we deal the first card, then spell the positive integers starting from O-N-E, moving a card from the top of the deck underneath the deck for each letter in the English spelling of the number, followed by dealing or "putting down" the top card. So we start by dealing the first card, then putting 3 cards under because O-N-E has three letters, then we deal the next card. Then we put 3 cards under because T-W-O has three letters, then we deal a card. Then we put 5 cards under for T-H-R-E-E, and so on. This dealing sequence is highly irregular because it depends on English spelling. The dealing pattern starts: DUUUDUUUDUUUUUD, where each "U" corresponds to putting a card “under” and each "D" corresponds to dealing a card “down”.
This card dealing can be thought of as a generalized version of the Josephus problem. In this version of the Josephus problem, we start by executing the first person, then spell the positive integers in increasing order, each time skipping past 1 person for each letter and executing the next person. The card in row n and column k is x if and only if in the corresponding Josephus problem with n people, the person numbered x is the k-th person eliminated.
Equivalently, each row of the corresponding Josephus triangle A381114 is an inverse permutation of the corresponding row of this triangle. The first column contains only ones, since person number 1 always dies first in the corresponding Josephus problem. The index of the largest number in row n is A381129(n), corresponding to the index of the freed person in the corresponding Josephus problem. The number of card moves that we need to take if we start with n cards is A381128(n).

Examples

			Triangle begins:
 1;
 1, 2;
 1, 3, 2;
 1, 2, 4, 3;
 1, 3, 5, 4, 2;
 1, 6, 4, 3, 2, 5;
 1, 5, 3, 6, 2, 4, 7;
 1, 3, 4, 5, 2, 7, 6, 8;
  ...
For n = 4, suppose there are four cards arranged in the order 1,2,4,3. Card 1 is dealt, and then three cards go under the deck because O-N-E has three letters. Now, the deck is ordered 2,4,3. Card 2 is dealt, and three cards go under because T-W-O has three letters. Now, the leftover deck is ordered 3,4. Card 3 is dealt, and five cards go under because T-H-R-E-E has five letters. Then card 4 is dealt. The dealt cards are in numerical order. Thus, the fourth row of the triangle is 1, 2, 4, 3.
		

Crossrefs

Programs

  • Python
    from num2words import num2words as n2w
    def f(n): return sum(1 for c in n2w(n).replace(" and", "") if c.isalpha())
    def row(n):
        c, i, J, out = 1, 0, list(range(1, n+1)), []
        while len(J) > 1:
            q = J.pop(i)
            out.append(q)
            i = (i + f(c))%len(J)
            c = c+1
        out.append(J[0])
        return [out.index(j)+1 for j in list(range(1, n+1))]
    print([e for n in range(1, 15) for e in row(n)]) # Michael S. Branicky, Feb 16 2025

A381128 The number of card moves required to deal n cards using Down-SpellUnder dealing.

Original entry on oeis.org

1, 5, 9, 15, 20, 25, 29, 35, 41, 46, 50, 57, 64, 73, 82, 90, 98, 108, 117, 126, 133, 143, 153, 165, 176, 187, 197, 209, 221, 232, 239, 249, 259, 271, 282, 293, 303, 315, 327, 338, 344, 353, 362, 373, 383, 393, 402, 413, 424, 434, 440, 449, 458, 469, 479, 489, 498, 509, 520, 530, 536, 545, 554, 565, 575, 585, 594, 605
Offset: 1

Views

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Feb 14 2025

Keywords

Comments

In Down-SpellUnder dealing, after dealing the i-th card we move a card from the top of the deck to the bottom for each letter in the English spelling of i. Then we deal the next card and proceed likewise. So we start by dealing card 1, then putting 3 cards under because O-N-E has three letters. Then, we deal the next card, and put three cards under 3 because T-W-O has three letters. We then deal again, put 5 under for T-H-R-E-E, and so on. This dealing sequence is highly irregular because it depends on English spelling. The dealing pattern starts: DUUUDUUUDUUUUUD, where D means 'deal', and U means 'under'.

Examples

			The dealing pattern to deal four cards is DUUUDUUUDUUUUUD. It contains 15 letters, so a(4) = 15.
		

Crossrefs

Programs

  • Python
    from num2words import num2words as n2w
    def spell(n):
        return sum(1 for c in n2w(n).replace(" and", "").replace(" ", "").replace(",", "").replace("-", ""))
    moves_so_far = 0
    l = []
    for i in range(1, 41):
        moves_so_far += 1
        l += [str(moves_so_far)]
        moves_so_far += spell(i)
    print(", ".join(l))

Formula

a(n) = A067278(n-1) + n.

A381129 A version of the Josephus problem: a(n) is the surviving integer under the spelling version of the elimination process, called Down-SpellUnder.

Original entry on oeis.org

1, 2, 2, 3, 3, 2, 7, 8, 4, 6, 4, 6, 7, 11, 10, 3, 14, 4, 17, 11, 3, 16, 7, 16, 7, 22, 2, 8, 24, 27, 7, 21, 13, 28, 30, 8, 3, 37, 12, 7, 8, 33, 7, 33, 44, 11, 32, 8, 6, 43, 2, 18, 49, 8, 32, 54, 26, 43, 44, 30, 40, 52, 26, 44, 8, 27, 60, 16, 11, 61, 70, 14, 58, 55
Offset: 1

Views

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Feb 14 2025

Keywords

Comments

Arrange n people numbered 1, 2, 3, ..., n in a circle, increasing clockwise. Execute the person numbered 1, then spell the letters of O-N-E, moving one person clockwise for each letter. Once you are done, eliminate the next person. Then, spell the letters of T-W-O; in other words, skip three people and eliminate the next person. Following this, spell the letters of T-H-R-E-E; in other words, skip five people and eliminate the next person. Continue until one person remains. The number of this person is a(n).

Examples

			Consider n = 4 people. The first person eliminated is number 1. This leaves the remaining people in the order 2, 3, 4. The second person eliminated is number 2; the people left are in the order 3, 4. The next person eliminated is numbered 4, leaving only the person numbered 3. Thus, a(4) = 3.
		

Crossrefs

Programs

  • Python
    from num2words import num2words as n2w
    def f(n): return sum(1 for c in n2w(n).replace(" and", "") if c.isalpha())
    def a(n):
        c, i, J = 1, 0, list(range(1, n+1))
        while len(J) > 1:
            q = J.pop(i)
            i = (i + f(c))%len(J)
            c = c+1
        return J[0]
    print([a(n) for n in range(1, 75)]) # Michael S. Branicky, Feb 16 2025

Extensions

a(22) and beyond from Michael S. Branicky, Feb 16 2025

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

Views

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.
		

Crossrefs

Formula

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

Extensions

a(15)-a(18) from Michael S. Branicky, Jul 23 2025
Showing 1-10 of 12 results. Next