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

A341766 a(n) = difference between the starting positions of the first digit of the binary representation of n, where n starts at its natural position in the string, and the second occurrence of the same string in the binary Champernowne string (starting at 0) 011011100101110111100010011010... (cf. A030190).

Original entry on oeis.org

3, 1, 4, 1, 12, 4, 5, 1, 32, 13, 2, 9, 15, 5, 6, 1, 80, 36, 12, 31, 76, 8, 23, 21, 39, 16, 69, 11, 18, 6, 7, 1, 192, 91, 38, 85, 3, 45, 20, 73, 163, 67, 2, 22, 40, 3, 45, 49, 95, 43, 139, 37, 118, 31, 3, 25, 46, 19, 137, 13, 21, 7, 8, 1, 448, 218, 100, 211, 31, 136, 79, 197, 429, 25, 58, 123
Offset: 0

Views

Author

Scott R. Shannon, Feb 19 2021

Keywords

Comments

Consider the infinite string 011011100101110111100010011010... (cf. A030190) formed by the concatenation of all binary digits of all nonnegative numbers. From the position of the first digit of the binary representation of n, where n starts as its natural position in the string, find the number of digits one has to move forward to get to the start of the second occurrence of n. This is a(n).

Examples

			a(0) = 3 as '0' starts at position 1 and appears again at position 4.
a(1) = 1 as '1' starts at position 2 and appears again at position 3.
a(4) = 12 as '100' starts at position 7 and appears again at position 19.
a(7) = 1 as '111' starts at position 16 and appears again at position 17.
a(8) = 32 as '1000' starts at position 19 and appears again at position 51.
		

Crossrefs

Programs

  • Python
    def a(n):
        b = s = bin(n)[2:]
        while s.find(b, 1) < 0: n += 1; s += bin(n)[2:]
        return s.find(b, 1)
    print([a(n) for n in range(76)]) # Michael S. Branicky, Sep 16 2022

Formula

From Michael S. Branicky, Sep 16 2022: (Start)
a(2^k-1) = 1, for k >= 1;
a(2^k) = (k+1)*2^k, for k >= 0. (End)

A351753 Take the first n digits on the binary Champernowne string (cf. A030302); a(n) gives the starting index of the second occurrence of this n-digit string within the binary Champernowne string.

Original entry on oeis.org

2, 4, 5, 12, 12, 12, 213, 517, 517, 517, 517, 517, 517, 517, 517, 517, 14457, 189569, 258049, 258049, 14144865, 14144865, 14144865, 131391133, 131391133, 199844657, 199844657, 199844657, 1196986333, 1196986333, 5176897753, 5176897753, 5176897753, 5176897753
Offset: 1

Views

Author

Scott R. Shannon, Feb 18 2022

Keywords

Comments

The twenty-first n-digit string is '110111001011101111000' (1808238 decimal) which cannot be readily split into consecutive smaller values implying it is likely its next occurrence is in its natural position, i.e., a(21) = 35876058.

Examples

			The binary Champernowne string starts 110111001011101111000100110101011....
a(1) = 2 as the second occurrence of '1' within the string starts at index 2.
a(2) = 4 as the second occurrence of '11' within the string starts at index 4.
a(3) = 5 as the second occurrence of '110' within the string starts at index 5.
a(4) = 12 as the second occurrence of '1101' within the string starts at index 12.
		

Crossrefs

Programs

  • Python
    from itertools import count
    def A351753(n):
        s1, s2 = tuple(), tuple()
        for i, s in enumerate(int(d) for n in count(1) for d in bin(n)[2:]):
            if i < n:
                s1 += (s,)
                s2 += (s,)
            else:
                s2 = s2[1:]+(s,)
                if s1 == s2:
                    return i-n+2 # Chai Wah Wu, Feb 18 2022
    (C++) // See Links section.

Extensions

a(18)-a(20) corrected and a(21)-a(34) added by Chai Wah Wu, Feb 18 2022

A342303 a(0) = 1; for n >= 1, a(n) = the decimal value of the binary number of the total binary digits back from the end of the concatenation of all previous binary terms where the binary value of n last appeared. If the binary value of n has not previously appeared then a(n) = 0.

Original entry on oeis.org

1, 1, 0, 3, 0, 5, 6, 4, 0, 0, 7, 14, 0, 16, 10, 15, 13, 0, 21, 0, 39, 10, 58, 8, 0, 49, 16, 81, 68, 36, 49, 72, 0, 39, 33, 25, 25, 0, 40, 16, 11, 106, 6, 7, 0, 9, 10, 26, 60, 85, 11, 70, 40, 9, 214, 30, 32, 52, 16, 0, 65, 30, 6, 226, 0, 24, 130, 161, 20, 0, 99, 0, 68, 216, 136, 0, 62, 26, 129
Offset: 0

Views

Author

Scott R. Shannon, Mar 07 2021

Keywords

Comments

The longest run of 0 terms, corresponding to binary values that have not previously appeared, for n up to 100000 is four, starting at n = 512. Not all powers of 2 are 0 as it may have appeared as a previous value's offset, e.g., a(65536) = 412323.

Examples

			a(1) = 1 as the binary string concatenation up to a(0) = '1', and the binary value of 1 is '1' which appears 1 (1_2) digit back from the end of the string.
a(2) = 0 as the binary string concatenation up to a(1) = '11', while the binary value of 2 is '10' which does not appear in the string.
a(3) = 3 as the binary string concatenation up to a(2) = '110', and the binary value of 3 is '11' which appears 3 (11_2) digits back from the end of the string.
a(5) = 5 as the binary string concatenation up to a(4) = '110110', and the binary value of 5 is '101' which appears 5 (101_2) digits back from the end of the string.
a(10) = 7 as the binary string concatenation up to a(9) = '11011010111010000', and the binary value of 10 is '1010' which appears 7 (111_2) digits back from the end of the string.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def agen():
        b = "1"
        yield 1
        for k in count(1):
            bk = bin(k)[2:]
            idx = b.rfind(bk)
            if idx == -1:
                yield 0
                b += "0"
            else:
                yield len(b) - idx
                b += bin(len(b) - idx)[2:]
    print(list(islice(agen(), 79))) # Michael S. Branicky, Mar 18 2022

A354049 The smallest number that includes all the digits of n but does not equal n.

Original entry on oeis.org

10, 10, 12, 13, 14, 15, 16, 17, 18, 19, 100, 101, 21, 31, 41, 51, 61, 71, 81, 91, 102, 12, 122, 32, 42, 52, 62, 72, 82, 92, 103, 13, 23, 133, 43, 53, 63, 73, 83, 93, 104, 14, 24, 34, 144, 54, 64, 74, 84, 94, 105, 15, 25, 35, 45, 155, 65, 75, 85, 95, 106, 16, 26, 36, 46, 56, 166, 76, 86, 96, 107
Offset: 0

Views

Author

Keywords

Comments

The terms cannot start with a leading zero so any number including a zero must have at least one digit greater than zero as its first digit. See the examples below.

Examples

			a(9) = 19 as there is no smaller number that includes the digit 9 but does not equal 9.
a(10) = 100 as there is no smaller number that includes the digits 1 and 0 but does not equal 10. Note that '01' = 1 is not allowed.
a(20) = 102 as there is no smaller number that includes the digits 2 and 0 but does not equal 20. Note that '02' = 2 is not allowed.
a(22) = 122 as there is no smaller number that includes two 2 digits but does not equal 22.
a(200) = 1002 as there is no smaller number that includes two 0 digits and the digit 2 but does not equal 200.
		

Crossrefs

Programs

  • PARI
    vd(n) = my(d=if (n, digits(n), [0])); vector(10, k, #select(x->(x==k-1), d));
    isok(k, n, d) = if (k!=n, my(dd=vd(k)); for (i=1, #d, if (dd[i] < d[i], return(0))); return(1));
    a(n) = my(k=0, d=vd(n)); while(!isok(k, n, d), k++); k; \\ Michel Marcus, May 17 2022
    
  • Python
    def ok(k, n):
        if k == n: return False
        sk, sn = str(k), str(n)
        return all(sk.count(d) >= sn.count(d) for d in set(sn))
    def a(n):
        k = 0
        while not ok(k, n): k += 1
        return k
    print([a(n) for n in range(71)]) # Michael S. Branicky, May 23 2022

A357432 a(1) = 1; a(2) = 2; for n > 2, a(n) is the smallest positive number not occurring earlier such that a(n) plus the sum of all previous terms appears in the string concatenation of a(1)..a(n-1).

Original entry on oeis.org

1, 2, 9, 17, 62, 38, 47, 115, 93, 87, 122, 30, 88, 51, 85, 4, 3, 31, 32, 21, 221, 64, 68, 302, 53, 116, 92, 268, 42, 48, 18, 78, 76, 97, 50, 153, 233, 108, 63, 20, 8, 16, 89, 12, 77, 537, 24, 377, 83, 46, 306, 28, 107, 197, 170, 126, 61, 566, 218, 82, 43, 25, 14, 148, 147, 6, 209, 145, 37, 103
Offset: 1

Views

Author

Scott R. Shannon, Sep 28 2022

Keywords

Comments

The sequence is conjectured to be a permutation of the positive integers. In the first 20000 terms the fixed points are 393, 514, 1546, and 7854, although more likely exist.

Examples

			a(4) = 17 as a(1) + a(2) + a(3) + 17 = 1 + 2 + 9 + 17 = 29, and "29" appears in the string concatenation of a(1)..a(3) = "129".
		

Crossrefs

A357433 a(1) = 1; a(2) = 2; for n > 2, a(n) is the smallest positive number not occurring earlier such that the binary string of a(n) plus the sum of all previous terms appears in the binary string concatenation of a(1)..a(n-1).

Original entry on oeis.org

1, 2, 3, 5, 12, 4, 9, 10, 11, 16, 14, 6, 7, 18, 17, 13, 15, 8, 20, 22, 24, 33, 26, 31, 21, 19, 25, 35, 30, 28, 56, 34, 36, 43, 32, 42, 37, 23, 29, 38, 27, 58, 45, 60, 46, 52, 44, 50, 72, 53, 54, 41, 65, 47, 40, 48, 66, 51, 64, 49, 57, 61, 67, 93, 77, 59, 74, 100, 75, 69, 91, 73, 83, 71, 81, 39, 82
Offset: 1

Views

Author

Scott R. Shannon, Sep 28 2022

Keywords

Comments

The sequence is conjectured to be a permutation of the positive integers. In the first 20000 terms there are twenty-five fixed points starting 3, 37, 84, 99, 103, 166.

Examples

			a(5) = 12 as a(1) + a(2) + a(3) + a(4) + 12 = 1 + 2 + 3 + 5 + 12 = 23 = 10111_2, and "10111" appears in the string concatenation of the binary values of a(1)..a(4) = "11011101".
		

Crossrefs

A342162 a(n) = difference between the starting positions of the first two occurrences of n in the Champernowne string (cf. A033307), where the first n is not required to be at its natural position.

Original entry on oeis.org

11, 9, 13, 14, 15, 16, 17, 18, 19, 20, 180, 1, 13, 37, 55, 73, 91, 109, 127, 145, 221, 17, 1, 34, 37, 55, 73, 91, 109, 127, 231, 35, 17, 1, 55, 37, 55, 73, 91, 109, 241, 53, 35, 17, 1, 76, 37, 55, 73, 91, 251, 71, 53, 35, 17, 1, 97, 37, 55, 73, 261, 89, 71, 53, 35, 17, 1, 118, 37, 55, 271, 107
Offset: 0

Views

Author

Scott R. Shannon, Mar 03 2021

Keywords

Comments

Consider the infinite string 01234567891011121314151617181920... (cf. A033307) formed by the concatenation of all decimal digits of all nonnegative numbers. From the position of the first digit of the first occurrence of the number n, which is not required to be at its natural position in the string, find the number of digits one has to move forward to get to the start of the second occurrence of n. This is a(n).
This sequence is similar to A337227 but here the first appearance of n can be anywhere in string. The first example where n appears before its natural position in the string is n = 12. See the examples.

Examples

			a(0) = 11 as the string '0' first appears at position 1 and again at position 12, giving a difference of 11.
a(10) = 180 as the string '10' first appears at position 11 and again at position 191 (where it forms the start of the number 100), giving a difference of 180.
a(12) = 13 as the string '12' first appears at position 2 (the first number to appear before its natural position) and again at position 15 (its natural position), giving a difference of 13. This is the first term to differ from A337227.
		

Crossrefs

Programs

  • Python
    from itertools import count
    def A342162(n):
        s1, s2, m = tuple(int(d) for d in str(n)), tuple(), -1
        l = len(s1)
        for i, s in enumerate(int(d) for k in count(0) for d in str(k)):
            s2 = (s2+(s,))[-l:]
            if s2 == s1:
                if m >= 0:
                    return i-m
                m = i # Chai Wah Wu, Feb 18 2022

A341537 a(n) is the number of digits from the end of the concatenation of all previous terms where n last appears. If n has not previously appeared then a(n) = n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 2, 14, 15, 16, 17, 18, 19, 20, 15, 22, 33, 24, 25, 26, 27, 28, 29, 30, 31, 17, 20, 54, 35, 36, 37, 38, 39, 40, 53, 35, 17, 44, 75, 46, 5, 48, 49, 50, 16, 52, 23, 13, 55, 95, 57, 58, 7, 60, 87, 69, 51, 64, 26, 66, 115, 68, 15, 70, 106, 79, 71, 61, 36
Offset: 0

Views

Author

Scott R. Shannon, Feb 14 2021

Keywords

Examples

			a(9) = 9 as the concatenation of all previous terms is "012345678" which does not include 9, so a(9) = 9.
a(12) = 13 as the concatenation of all previous terms is "01234567891011" which includes "12" as a substring, starting 13 digits from the end of the concatenation.
a(13) = 2 as the concatenation of all previous terms is "0123456789101113" which includes "13" as a substring, starting 2 digits from the end of the concatenation.
		

Crossrefs

A357880 a(1) = a(2) = 1; for n > 2, a(n) is the smallest positive number such that a(n) plus the sum of all previous terms appears in the string concatenation of a(1)..a(n-1).

Original entry on oeis.org

1, 1, 9, 8, 79, 21, 79, 19, 574, 1, 87, 40, 2, 36, 30, 211, 593, 83, 83, 30, 128, 64, 184, 501, 148, 9, 280, 329, 203, 5, 185, 161, 3, 314, 391, 119, 150, 24, 556, 197, 195, 64, 105, 108, 8, 777, 207, 16, 302, 52, 147, 2, 111, 298, 53, 67, 66, 20, 105, 99, 37, 15, 85, 51, 183, 39, 45, 8, 14
Offset: 1

Views

Author

Scott R. Shannon, Oct 18 2022

Keywords

Comments

It is conjectured that all numbers eventually appear. In the first 100000 terms the only fixed point is 210; it is likely no more exist.

Examples

			a(6) = 21 as a(1) + ... + a(5) + 21 = 98 + 21 = 119, and "119" appears in the string concatenation of a(1)..a(5) = "119879".
		

Crossrefs

Programs

  • Mathematica
    nn = 120; a[1] = a[2] = 1; s = 2; w = "11"; Do[k = 1; While[! StringContainsQ[w, ToString[k + s]], k++]; a[n] = k; s += k; w = StringJoin[w, ToString[k]], {n, 3, nn}]; Array[a, nn] (* Michael De Vlieger, Oct 20 2022 *)
Showing 1-9 of 9 results.