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-4 of 4 results.

A098067 Consider the succession of single digits of the positive integers: 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 ... (A007376). This sequence is the lexicographically earliest derangement of the positive integers that produces the same succession of digits.

Original entry on oeis.org

12, 3, 4, 5, 6, 7, 8, 9, 10, 1, 112, 13, 14, 15, 16, 17, 18, 19, 20, 2, 122, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73
Offset: 1

Views

Author

Eric Angelini, Sep 13 2004

Keywords

Comments

Derangement here means that a(n) != n.

Examples

			We must begin with "1,2,3,..." and we cannot have a(1) = 1, so the first possible term is "12". The next term must be the smallest available positive integer not leading to a contradiction, thus "3"; the next one will be "4"; etc. After a(10) = 1, we cannot have a(11) = 11, so we use "112" instead. We are not allowed to use "2" after "19" because the next term would have a leading zero, which is forbidden. - _Eric Angelini_, Aug 12 2008
		

Crossrefs

Programs

  • Mathematica
    lim = 80; f[lst_List, k_] := Block[{L = lst, g, a = {}, m = 0}, g[] := {Set[m, First@ FromDigits@ Append[IntegerDigits@ m, First@ #]], Set[L, Last@ #]} &@ TakeDrop[L, 1]; Do[g[]; While[Or[m == Length@ a + 1, First@ L == 0, MemberQ[a, m]], g[]]; AppendTo[a, m]; m = 0, {k}]; a]; f[Flatten@ Map[IntegerDigits, Range@ lim], Floor[lim - 10^(Log10@ lim - 1)]] (* Michael De Vlieger, Nov 29 2015, Version 10.2 *)
  • Perl
    See Link section.
    
  • Python
    from itertools import count
    def diggen():
        for k in count(1): yield from list(map(int, str(k)))
    def aupton(terms):
        g = diggen()
        alst, aset, , , nextd = [12], {12}, next(g), next(g), next(g)
        for n in range(2, terms+1):
            an, nextd = nextd, next(g)
            while an in aset or an == n or nextd == 0:
                an, nextd = int(str(an) + str(nextd)), next(g)
            alst.append(an); aset.add(an)
        return alst
    print(aupton(72)) # Michael S. Branicky, Dec 03 2021

Extensions

Corrected and extended by Jacques ALARDET and Eric Angelini, Aug 12 2008
Derangement wording introduced by Danny Rorabaugh, Nov 26 2015
Edited by Danny Rorabaugh, Nov 29 2015

A197124 Extract positive numbers from the infinite string of prime numbers 235711131719..., constructing the smallest numbers which have not appeared in an earlier extraction.

Original entry on oeis.org

2, 3, 5, 7, 1, 11, 31, 71, 9, 23, 29, 313, 74, 14, 34, 75, 35, 96, 16, 77, 17, 37, 98, 38, 99, 710, 110, 310, 7109, 113, 12, 713, 1137, 13, 91, 4, 915, 115, 716, 316, 717, 317, 918, 119, 1193, 19, 719, 92, 112, 232, 27, 22, 923, 32, 39, 24, 125, 1257, 26
Offset: 1

Views

Author

Yves Debeuret, Oct 10 2011

Keywords

Comments

The infinite stream of prime digits is basically chopped into slices such that each of the digits is used exactly once and the outcoming stream does not contain duplicates.

Examples

			The initial digits 2, 3, 5, 7 and 1 are all extracted in the order of occurrence. The next 1 is rejected because it appeared earlier, and united with the (overall) third 1 to extract 11. The next 3 (from 13) appeared already earlier and is combined with the following 1 (from the 17) to created 31.
		

Crossrefs

Programs

  • Mathematica
    nn=100; digs = Flatten[Table[IntegerDigits[Prime[n]], {n, nn}]]; numList = {}; While[digs != {}, num = 0; While[num = num*10 + digs[[1]]; digs = Rest[digs]; newNum = ! MemberQ[numList, num]; (num == 0 || ! newNum) && digs != {}]; If[newNum, AppendTo[numList, num]]]; numList (* T. D. Noe, Oct 31 2011 *)
  • Python
    from sympy import nextprime
    from itertools import islice
    def diggen():
        p = 2
        while True:
            yield from list(map(int, str(p)))
            p = nextprime(p)
    def agen(): # generator of terms
        g = diggen()
        aset, nextd = set(), next(g)
        while True:
            an, nextd = nextd, next(g)
            while an in aset or nextd == 0:
                an, nextd = int(str(an) + str(nextd)), next(g)
            yield an
            aset.add(an)
    print(list(islice(agen(), 80))) # Michael S. Branicky, Mar 31 2022

A229084 Lexicographically earliest sequence of distinct positive integers written in base 2 such that the concatenation of the terms equals the concatenation of the positive integers, and no term appears in its natural position.

Original entry on oeis.org

110, 1, 1100, 10, 11, 101, 111000, 100, 11010, 10111, 1001, 1011, 1101, 111, 100001000, 110010, 1001110, 10010, 10110, 110101, 1111000, 110011, 1010, 110111, 11001, 11011, 1110, 1111, 1100000, 10000, 11000, 101000, 11100, 100100, 101100, 110100, 11110, 1000
Offset: 1

Views

Author

Jaroslav Krizek, Sep 13 2013

Keywords

Comments

Leading zeros are forbidden.
The positive integers written in base 10:
+-+--+--+---+---+---+---+----+----+----+----+----+----+----+
|1| 2| 3| 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |...
+-+--+--+---+---+---+---+----+----+----+----+----+----+----+
The positive integers written in base 2:
+-+--+--+---+---+---+---+----+----+----+----+----+----+----+
|1|10|11|100|101|110|111|1000|1001|1010|1011|1100|1101|1110|...
+-+--+--+---+---+---+---+----+----+----+----+----+----+----+
This sequence:
+----+-+----+--+--+---+------+---+-----+-----+----+----+----+
| 110|1|1100|10|11|101|111000|100|11010|10111|1001|1011|1101|...
+----+-+----+--+--+---+------+---+-----+-----+----+----+----+
Numbers from this sequence written in base 10 (A229085):
+----+-+----+--+--+---+------+---+-----+-----+----+----+----+
| 6 |1| 12 | 2| 3| 5 | 56 | 4 | 26 | 23 | 9 | 11| 13|...
+----+-+----+--+--+---+------+---+-----+-----+----+----+----+

Crossrefs

Cf. A228595 (like sequence in base 10), A007088 (numbers written in base 2), A229085.

A229085 Sequence A229084 written in base 10.

Original entry on oeis.org

6, 1, 12, 2, 3, 5, 56, 4, 26, 23, 9, 11, 13, 7, 264, 50, 78, 18, 22, 53, 120, 51, 10, 55, 25, 27, 14, 15, 96, 16, 24, 40, 28, 36, 44, 52, 30, 8, 20, 106, 21, 108, 182, 58, 31, 33, 17, 101, 19, 105, 43, 45, 47, 49, 103, 174, 252, 123, 61, 4032, 32, 48, 80, 452
Offset: 1

Views

Author

Jaroslav Krizek, Sep 13 2013

Keywords

Comments

A229084 = lexicographically earliest sequence of distinct positive integers written in base 2 such that the concatenation of the terms equals the concatenation of the positive integers, and no term appears in its natural position. Leading zeros are forbidden.
The positive integers written in base 10 (A000027):
+-+--+--+---+---+---+---+----+----+----+----+----+----+----+
|1| 2| 3| 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |...
+-+--+--+---+---+---+---+----+----+----+----+----+----+----+
The positive integers written in base 2 (A007088):
+-+--+--+---+---+---+---+----+----+----+----+----+----+----+
|1|10|11|100|101|110|111|1000|1001|1010|1011|1100|1101|1110|...
+-+--+--+---+---+---+---+----+----+----+----+----+----+----+
Sequence A229084:
+----+-+----+--+--+---+------+---+-----+-----+----+----+----+
| 110|1|1100|10|11|101|111000|100|11010|10111|1001|1011|1101|...
+----+-+----+--+--+---+------+---+-----+-----+----+----+----+
This sequence a(n):
+----+-+----+--+--+---+------+---+-----+-----+----+----+----+
| 6 |1| 12 | 2| 3| 5 | 56 | 4 | 26 | 23 | 9 | 11| 13|...
+----+-+----+--+--+---+------+---+-----+-----+----+----+----+

Crossrefs

Cf. A228595 (like sequence in base 10), A007088 (numbers written in base 2), A229084.

Programs

  • Perl
    See Link section.

Extensions

Corrected by Paul Tek, Sep 19 2013
Showing 1-4 of 4 results.