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.

A260273 Successively add the smallest nonzero binary number that is not a substring.

Original entry on oeis.org

1, 3, 5, 8, 11, 15, 17, 20, 23, 27, 31, 33, 36, 39, 44, 51, 56, 61, 65, 68, 71, 76, 81, 84, 87, 91, 95, 99, 104, 111, 115, 120, 125, 129, 132, 135, 140, 145, 148, 151, 157, 165, 168, 171, 175, 179, 186, 190, 194, 199, 204, 209, 216, 223, 227, 232, 241, 246
Offset: 1

Views

Author

Alex Meiburg, Jul 22 2015

Keywords

Comments

a(n) is at least Omega(n), at most O(n*log(n)).
The empirical approximation n*(log(n)/2 + exp(1)) is startlingly close to tight, compared with many increasing upper bounds.
A261644(n) = A062383(a(n)) - a(n). - Reinhard Zumkeller, Aug 30 2015

Examples

			Begin with a(1)=1, in binary, "1". This contains the string "1" but not "10", so we add 2. Thus a(2)=1+2=3. This also contains "1" but not "10", so we move to a(3)=3+2=5. This contains "1" and "10" but not "11", so we add 3. Thus a(4)=5+3=8. (See A261018 for the successive numbers that are added. - _N. J. A. Sloane_, Aug 17 2015)
		

Crossrefs

See A261922 and A261461 for the smallest missing number function; also A261923, A262279, A261281.
See also A261396 (when a(n) just passes a power of 2), A261416 (the limiting behavior just past a power of 2).
First differences are A261018.
A262288 is the decimal analog.

Programs

  • Haskell
    a260273 n = a260273_list !! (n-1)
    a260273_list = iterate (\x -> x + a261461 x) 1
    -- Reinhard Zumkeller, Aug 30 2015, Aug 17 2015
    
  • Java
    public static void main(String[] args) {
       int a=1;
       for(int iter=0;iter<100;iter++){
           System.out.print(a+", ");
           int inc;
           for(inc=1; contains(a,inc); inc++);
           a+=inc;
       }
    }
    static boolean contains(int a,int test){
       int mask=(Integer.highestOneBit(test)<<1)-1;
       while(a >= test){
           if((a & mask) == test) return true;
           a >>= 1;
       }
       return false;
    }
    
  • Mathematica
    sublistQ[L1_, L2_] := Module[{l1 = Length[L1], l2 = Length[L2], k}, If[l2 <= l1, For[k = 1, k <= l1 - l2 + 1, k++, If[L1[[k ;; k + l2 - 1]] == L2, Return[True]]]]; False];
    a[1] = 1; a[n_] := a[n] = Module[{bb = IntegerDigits[a[n-1], 2], k}, For[k = 1, sublistQ[bb, IntegerDigits[k, 2]], k++]; a[n-1] + k]; Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Apr 01 2016 *)
    NestList[Function[k, k + FromDigits[#, 2] &@ SelectFirst[IntegerDigits[Range[2^8], 2], Length@ SequencePosition[IntegerDigits[k, 2], #] == 0 &]], 1, 64] (* Michael De Vlieger, Apr 01 2016, Version 10.1 *)
  • Python
    A260273_list, a = [1], 1
    for i in range(10**3):
        b, s = 1, format(a,'b')
        while format(b,'b') in s:
            b += 1
        a += b
        s = format(a,'b')
        A260273_list.append(a) # Chai Wah Wu, Aug 26 2015

Formula

a(n+1) = a(n) + A261461(a(n)). - Reinhard Zumkeller, Aug 30 2015

A261019 Irregular triangle read by rows: T(n,k) (0 <= k <= A261017(n)) = number of binary strings of length n such that the smallest number whose binary representation is not visible in the string is k.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 3, 6, 4, 1, 1, 1, 4, 11, 10, 5, 1, 1, 5, 19, 21, 15, 0, 2, 1, 1, 6, 32, 40, 35, 2, 9, 2, 1, 1, 7, 53, 72, 73, 6, 31, 10, 2, 1, 1, 8, 87, 125, 144, 15, 79, 40, 12, 1, 1, 9, 142, 212, 274, 32, 185, 116, 52, 1, 1, 10, 231, 354, 509, 64, 408, 296, 168, 2, 4
Offset: 1

Views

Author

Alois P. Heinz and N. J. A. Sloane, Aug 17 2015

Keywords

Comments

This is a more compact version of the triangle in A261015, ending each row at the last nonzero entry.

Examples

			The first 16 rows are:
1, 1,
1, 1,  1,    1,
1, 1,  2,    3,    1,
1, 1,  3,    6,    4,    1,
1, 1,  4,   11,   10,    5,
1, 1,  5,   19,   21,   15,    0,     2,
1, 1,  6,   32,   40,   35,    2,     9,     2,
1, 1,  7,   53,   72,   73,    6,    31,    10,     2,
1, 1,  8,   87,  125,  144,   15,    79,    40,    12,
1, 1,  9,  142,  212,  274,   32,   185,   116,    52,
1, 1, 10,  231,  354,  509,   64,   408,   296,   168,    2,    4,
1, 1, 11,  375,  585,  931,  120,   864,   699,   461,   24,   24,
1, 1, 12,  608,  960, 1685,  218,  1771,  1557,  1133,  130,  110,   2,   4,
1, 1, 13,  985, 1568, 3027,  385,  3555,  3325,  2612,  471,  387,  14,  24,  0,  16,
1, 1, 14, 1595, 2553, 5409,  668,  7021,  6893,  5759, 1401, 1135,  92, 120,  0,  90, 16,
1, 1, 15, 2582, 4148, 9628, 1142, 13696, 13964, 12309, 3734, 2972, 373, 439, 28, 390, 98, 16,
...
		

Crossrefs

The row lengths are given by A261017.
Cf. A076478, A030308, A000079 (row sums), A261392 (max per row).

Programs

  • Haskell
    import Data.List (isInfixOf, sort, group)
    a261019 n k = a261019_tabf !! (n-1) !! k
    a261019_row n = a261019_tabf !! (n-1)
    a261019_tabf = map (i 0 . group . sort . map f) a076478_tabf
       where f bs = g a030308_tabf where
               g (cs:css) | isInfixOf cs bs = g css
                          | otherwise = foldr (\d v -> 2 * v + d) 0 cs
             i _ [] = []
             i r gss'@(gs:gss) | head gs == r = (length gs) : i (r + 1) gss
                               | otherwise    = 0 : i (r + 1) gss'
    -- Reinhard Zumkeller, Aug 18 2015

A261015 Irregular triangle read by rows: T(n,k) (0 <= k <= 2^n-1) = number of binary strings of length n such that the smallest number whose binary representation is not visible in the string is k.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 0, 0, 0, 1, 1, 3, 6, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 4, 11, 10, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 5, 19, 21, 15, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

N. J. A. Sloane, Aug 16 2015

Keywords

Comments

Suggested by A260273.

Examples

			Triangle begins:
  1,1,
  1,1,1,1,
  1,1,2,3,1,0,0,0,
  1,1,3,6,4,1,0,0,0,0,0,0,0,0,0,0,
...
For row 3, here are the 8 strings of length 3 and for each one, the smallest missing number k:
 000 1
 001 2
 010 3
 011 2
 100 3
 101 3
 110 4
 111 0
		

Crossrefs

See A261019 for a more compact version (which has further information about the columns).

Programs

  • Mathematica
    notVis[bits_] := For[i = 0, True, i++, If[SequencePosition[bits, IntegerDigits[i, 2]] == {}, Return[i]]];
    T[n_, k_] := Select[Rest[IntegerDigits[#, 2]]& /@ Range[2^n, 2^(n+1)-1], notVis[#] == k&] // Length;
    Table[T[n, k], {n, 1, 6}, {k, 0, 2^n-1}] // Flatten (* Jean-François Alcover, Aug 02 2018 *)

Extensions

More terms from Alois P. Heinz, Aug 17 2015

A261017 a(n) = max k such that A261015(n,k) is not zero.

Original entry on oeis.org

1, 3, 4, 5, 5, 7, 8, 9, 9, 9, 11, 11, 13, 15, 16, 17, 17, 17, 17, 19, 19, 19, 21, 21, 23, 23, 23, 27, 29, 31, 32, 33, 33, 33, 33, 33, 35, 35, 35, 35, 37, 37, 37, 39, 39, 39, 39, 41, 41, 43, 43, 45, 45, 45, 47, 47, 47, 47
Offset: 1

Views

Author

N. J. A. Sloane, Aug 17 2015

Keywords

Crossrefs

Programs

  • Haskell
    a261017 = subtract 1 . length . a261019_row
    -- Reinhard Zumkeller, Aug 18 2015
  • Mathematica
    (* This program is not suitable to compute more than a dozen terms. *)
    notVis[bits_] := For[i = 0, True, i++, If[SequencePosition[bits, IntegerDigits[i, 2]] == {}, Return[i]]];
    T[n_, k_] := Select[Rest[IntegerDigits[#, 2]] & /@ Range[2^n, 2^(n+1) - 1], notVis[#] == k &] // Length;
    a[n_] := Do[If[T[n, k] > 0, Return[k]], {k, 2^n - 1, 0, -1}];
    Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 1, 12}] (* Jean-François Alcover, Aug 02 2018 *)

Extensions

a(5)-a(17) from Alois P. Heinz, Aug 17 2015
a(18)-a(25) from Reinhard Zumkeller, Aug 18 2015
a(26)-a(36) from Alois P. Heinz, Aug 19 2015
a(37)-a(58) from Hiroaki Yamanouchi, Aug 23 2015
Showing 1-4 of 4 results.