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.

A037013 Reading binary expansion from right to left, run lengths strictly decrease.

Original entry on oeis.org

0, 1, 3, 4, 7, 8, 15, 16, 24, 31, 32, 39, 48, 63, 64, 79, 96, 112, 127, 128, 143, 159, 192, 224, 255, 256, 287, 319, 384, 399, 448, 480, 511, 512, 543, 575, 624, 639, 768, 799, 896, 960, 1023, 1024, 1087, 1151, 1248, 1279, 1536, 1567, 1599, 1792, 1920, 1984, 2047, 2048, 2111
Offset: 1

Views

Author

Keywords

Crossrefs

Subsequence of A037014, cf. A037015, A037016.

Programs

  • Haskell
    import Data.List (unfoldr, group)
    a037013 n = a037013_list !! (n-1)
    a037013_list = 0 : filter
       (all (< 0) . (\x -> zipWith (-) (tail $ rls x) $ rls x)) [1..] where
           rls = map length . group . unfoldr
                 (\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2)
    -- Reinhard Zumkeller, Mar 10 2012
  • Mathematica
    Select[Range[0,2200],Min[Differences[Length/@Split[ IntegerDigits[ #,2]]]]>0&] (* Harvey P. Dale, Dec 17 2012 *)

Extensions

More terms from Patrick De Geest, Feb 15 1999
Offset fixed and missing 1024 and 2047 inserted by Reinhard Zumkeller, Mar 10 2012

A037015 Numbers n with property that, reading binary expansion of n from right to left, run lengths strictly increase.

Original entry on oeis.org

0, 1, 3, 6, 7, 14, 15, 28, 30, 31, 57, 60, 62, 63, 120, 121, 124, 126, 127, 241, 248, 249, 252, 254, 255, 483, 496, 497, 504, 505, 508, 510, 511, 966, 993, 995, 1008, 1009, 1016, 1017, 1020, 1022, 1023, 1987, 1990, 2016, 2017, 2019, 2032, 2033, 2040, 2041, 2044
Offset: 1

Views

Author

Keywords

Comments

There are A000009(k) elements of this list consisting of k bits. - Jason Kimberley, Jan 22 2013

Examples

			From _Jason Kimberley_, Jan 30 2013: (Start)
Interleaved lines:
binary expansions,
corresponding run lengths (distinct partitions);
1,
1;
11,
2;
110, 111,
2,1; 3;
1110, 1111,
3,1; 4;
11100, 11110, 11111,
3,2; 4,1; 5;
111001, 111100, 111110, 111111,
3,2,1; 4,2; 5,1; 6;
1111000, 1111001, 1111100, 1111110, 1111111,
4,3; 4,2,1; 5,2; 6,1; 7;
11110001, 11111000, 11111001, 11111100, 11111110, 11111111
4,3,1; 5,3; 5,2,1; 6,2; 7,1; 8;
111100011, 111110000, 111110001, 111111000, 111111001, 111111100, 111111110, 111111111,
4,3,2; 5,4; 5,3,1; 6,3; 6,2,1; 7,2; 8,1; 9;
Notice the reversed sorting when a part corresponds to a run of 0's.
(End)
		

Crossrefs

Subsequence of A037016, cf. A037013, A037014.
Cf. A030308.

Programs

  • Haskell
    import Data.List (group)
    a037015 n = a037015_list !! (n-1)
    a037015_list = filter (all (> 0) . ds) [0..] where
       ds x = zipWith (-) (tail gs) gs where
          gs = map length $ group $ a030308_row x
    -- Reinhard Zumkeller, Jul 31 2013, Mar 10 2012
    
  • Mathematica
    Select[Range[0,2500],Min[Differences[Length/@Split[ Reverse[ IntegerDigits[ #,2]]]]]>0&] (* Harvey P. Dale, Nov 18 2014 *)
    Select[Range[0,2100],Max[Differences[Length/@Split[IntegerDigits[#,2]]]]<0&] (* Harvey P. Dale, Jun 28 2020 *)
  • Python
    from itertools import groupby
    A037015_list = []
    for n in range(10**5):
        c = None
        for x, y in groupby(bin(n)[2:]):
            z = len(list(y))
            if c != None and z >= c:
                break
            c = z
        else:
            A037015_list.append(n) # Chai Wah Wu, Sep 14 2021

Extensions

More terms from Patrick De Geest, Feb 15 1999
Offset fixed and missing 1023 inserted by Reinhard Zumkeller, Mar 10 2012

A037016 Numbers n with property that reading binary expansion from right to left (least significant to most significant), run lengths do not decrease.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 7, 10, 12, 13, 14, 15, 21, 25, 26, 28, 29, 30, 31, 42, 50, 51, 53, 56, 57, 58, 60, 61, 62, 63, 85, 101, 102, 106, 113, 114, 115, 117, 120, 121, 122, 124, 125, 126, 127, 170, 202, 204, 205, 213, 226, 227, 229, 230, 234, 240, 241, 242, 243, 245, 248
Offset: 1

Views

Author

Keywords

Comments

There are A000041(k) elements of this list consisting of k bits: a partition of k written in nonincreasing order corresponds to the binary expansion which when read left to right has run lengths as listed in the partition (reading left to right forces the initial run to be of 1s). - Jason Kimberley, Feb 08 2013
This sequence is a subsequence of A061854 (if we allow the initial 0 to be represented by the empty bit string). - Jason Kimberley, Feb 08 2013
The positive entries are those n for which row n of A101211 is weakly decreasing. Example: 6 is in the sequence because row 6 of A101211 is [2,1]; 8 is not in the sequence because row 8 of A101211 is [1,3]. - Emeric Deutsch, Jan 21 2018

Crossrefs

Cf. A037015 (subsequence), A037014, A037013.

Programs

  • Haskell
    import Data.List (unfoldr, group)
    a037016 n = a037016_list !! (n-1)
    a037016_list = 0 : filter
       (all (>= 0) . (\x -> zipWith (-) (tail $ rls x) $ rls x)) [1..] where
           rls = map length . group . unfoldr
                 (\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2)
    -- Reinhard Zumkeller, Mar 10 2012
  • Mathematica
    Select[ Range[0, 250], OrderedQ[ Reverse[ Length /@ Split[ IntegerDigits[#, 2] ] ] ]&] (* Jean-François Alcover, Apr 05 2013 *)

Extensions

More terms from Patrick De Geest, Feb 15 1999
Offset fixed by Reinhard Zumkeller, Mar 10 2012

A335834 Sort the run lengths in binary expansion of n in ascending order (with multiplicities).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 4, 7, 8, 11, 10, 11, 12, 11, 8, 15, 16, 23, 20, 19, 20, 21, 20, 23, 24, 19, 20, 19, 24, 23, 16, 31, 32, 47, 40, 39, 44, 43, 44, 39, 40, 43, 42, 43, 44, 43, 40, 47, 48, 39, 44, 51, 44, 43, 44, 39, 56, 39, 40, 39, 48, 47, 32, 63, 64, 95, 80, 79
Offset: 0

Views

Author

Rémy Sigrist, Jun 26 2020

Keywords

Comments

This sequence preserves the number of runs (A005811) and the length (A070939) of the binary representation of a number.

Examples

			For n = 72:
- the binary representation of 72 is "1001000",
- the corresponding run lengths are: 1, 2, 1, 3,
- in ascending order: 1, 1, 2, 3,
- so the binary representation of a(72) is "1011000",
- and a(72) = 88.
		

Crossrefs

Cf. A005811, A037014 (fixed points), A070939, A101211, A335835.

Programs

  • Mathematica
    Array[FromDigits[Flatten@ MapIndexed[ConstantArray[Mod[First[#2], 2], #1] &, Sort[Length /@ Split[IntegerDigits[#, 2]]]], 2] &, 67] (* Michael De Vlieger, Jun 27 2020 *)
  • PARI
    torl(n) = { my (rr=[]); while (n, my (r=valuation(n+(n%2), 2)); rr = concat(r, rr); n\=2^r); rr }
    fromrl(rr) = { my (v=0); for (k=1, #rr, v = (v+(k%2))*2^rr[k]-(k%2)); v }
    a(n) = { fromrl(vecsort(torl(n))) }

Formula

a(a(n)) = a(n).
Showing 1-4 of 4 results.