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 30 results. Next

A385892 In the sequence of run lengths of binary indices of each positive integer (A245563), remove all duplicate rows after the first and take the last term of each remaining row.

Original entry on oeis.org

1, 2, 1, 3, 1, 2, 4, 1, 1, 2, 3, 5, 1, 1, 1, 2, 2, 3, 4, 6, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 5, 7, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 7
Offset: 1

Views

Author

Gus Wiseman, Jul 18 2025

Keywords

Comments

A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.

Examples

			The binary indices of 53 are {1,3,5,6}, with maximal runs ((1),(3),(5,6)), with lengths (1,1,2), which is the 16th row of A385817, so a(16) = 2.
		

Crossrefs

In the following references, "before" is short for "before removing duplicate rows".
Positions of firsts appearances appear to be A000071.
Without the removals we have A090996.
For sum instead of last we have A200648, before A000120.
For length instead of last we have A200650+1, before A069010 = A037800+1.
Last term of row n of A385817 (ranks A385818, before A385889), first A083368.
A245563 gives run lengths of binary indices, see A245562, A246029, A328592.
A384877 gives anti-run lengths of binary indices, A385816.

Programs

  • Mathematica
    Last/@DeleteDuplicates[Table[Length/@Split[Join@@Position[Reverse[IntegerDigits[n,2]],1],#2==#1+1&],{n,100}]]

A385890 Positions of first appearances in A245563 = run lengths of binary indices.

Original entry on oeis.org

1, 2, 4, 6, 8, 12, 14, 16, 22, 24, 28, 30, 32, 44, 46, 48, 54, 56, 60, 62, 64, 86, 88, 92, 94, 96, 108, 110, 112, 118, 120, 124, 126, 128, 172, 174, 176, 182, 184, 188, 190, 192, 214, 216, 220, 222, 224, 236, 238, 240, 246, 248, 252, 254, 256, 342, 344, 348
Offset: 1

Views

Author

Gus Wiseman, Jul 18 2025

Keywords

Comments

A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.

Crossrefs

These are positions of firsts appearances in A245563, ranks A385889, reverse A245562.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.
A384877 lists anti-run lengths of binary indices, ranks A385816.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    q=Table[Length/@Split[bpe[n],#2==#1+1&],{n,0,1000}];
    Select[Range[Length[q]-1],!MemberQ[Take[q,#-1],q[[#]]]&]

A328592 Numbers whose binary expansion has all different lengths of runs of 1's.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 7, 8, 11, 12, 13, 14, 15, 16, 19, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 35, 38, 39, 44, 46, 47, 48, 49, 50, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 67, 70, 71, 76, 78, 79, 88, 92, 94, 95, 96, 97, 98, 100, 103, 104, 110, 111, 112, 113, 114
Offset: 1

Views

Author

Gus Wiseman, Oct 20 2019

Keywords

Comments

Also numbers whose binary indices have different lengths of runs of successive parts. A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.
The complement is {5, 9, 10, 17, 18, 20, 21, 27, ...}.

Examples

			The sequence of terms together with their binary expansions and binary indices begins:
   0:     0 ~ {}
   1:     1 ~ {1}
   2:    10 ~ {2}
   3:    11 ~ {1,2}
   4:   100 ~ {3}
   6:   110 ~ {2,3}
   7:   111 ~ {1,2,3}
   8:  1000 ~ {4}
  11:  1011 ~ {1,2,4}
  12:  1100 ~ {3,4}
  13:  1101 ~ {1,3,4}
  14:  1110 ~ {2,3,4}
  15:  1111 ~ {1,2,3,4}
  16: 10000 ~ {5}
  19: 10011 ~ {1,2,5}
  22: 10110 ~ {2,3,5}
  23: 10111 ~ {1,2,3,5}
  24: 11000 ~ {4,5}
  25: 11001 ~ {1,4,5}
  26: 11010 ~ {2,4,5}
		

Crossrefs

The version for prime indices is A130091.
The binary expansion of n has A069010(n) runs of 1's.
The lengths of runs of 1's in the binary expansion of n are row n of A245563.
Numbers whose binary expansion has equal lengths of runs of 1's are A164707.

Programs

  • Mathematica
    Select[Range[0,100],UnsameQ@@Length/@Split[Join@@Position[Reverse[IntegerDigits[#,2]],1],#2==#1+1&]&]

A164707 A positive integer n is included if all runs of 1's in binary n are of the same length.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 17, 18, 20, 21, 24, 27, 28, 30, 31, 32, 33, 34, 36, 37, 40, 41, 42, 48, 51, 54, 56, 60, 62, 63, 64, 65, 66, 68, 69, 72, 73, 74, 80, 81, 82, 84, 85, 96, 99, 102, 108, 112, 119, 120, 124, 126, 127, 128, 129, 130, 132, 133, 136
Offset: 1

Views

Author

Leroy Quet, Aug 23 2009

Keywords

Comments

Clarification: A binary number consists of "runs" completely of 1's alternating with runs completely of 0's. No two or more runs all of the same digit are adjacent.
This sequence contains in part positive integers that each contain one run of 1's. For those members of this sequence each with at least two runs of 1's, see A164709.

Examples

			From _Gus Wiseman_, Oct 31 2019: (Start)
The sequence of terms together with their binary expansions and binary indices begins:
   1:      1 ~ {1}
   2:     10 ~ {2}
   3:     11 ~ {1,2}
   4:    100 ~ {3}
   5:    101 ~ {1,3}
   6:    110 ~ {2,3}
   7:    111 ~ {1,2,3}
   8:   1000 ~ {4}
   9:   1001 ~ {1,4}
  10:   1010 ~ {2,4}
  12:   1100 ~ {3,4}
  14:   1110 ~ {2,3,4}
  15:   1111 ~ {1,2,3,4}
  16:  10000 ~ {5}
  17:  10001 ~ {1,5}
  18:  10010 ~ {2,5}
  20:  10100 ~ {3,5}
  21:  10101 ~ {1,3,5}
  24:  11000 ~ {4,5}
  27:  11011 ~ {1,2,4,5}
(End)
		

Crossrefs

The version for prime indices is A072774.
The binary expansion of n has A069010(n) runs of 1's.
Numbers whose runs are all of different lengths are A328592.
Partitions with equal multiplicities are A047966.
Numbers whose binary expansion is aperiodic are A328594.
Numbers whose reversed binary expansion is a necklace are A328595.
Numbers whose reversed binary expansion is a Lyndon word are A328596.

Programs

  • Maple
    isA164707 := proc(n) local bdg,arl,lset ; bdg := convert(n,base,2) ; lset := {} ; arl := -1 ; for p from 1 to nops(bdg) do if op(p,bdg) = 1 then if p = 1 then arl := 1 ; else arl := arl+1 ; end if; else if arl > 0 then lset := lset union {arl} ; end if; arl := 0 ; end if; end do ; if arl > 0 then lset := lset union {arl} ; end if; return (nops(lset) <= 1 ); end proc: for n from 1 to 300 do if isA164707(n) then printf("%d,",n) ; end if; end do; # R. J. Mathar, Feb 27 2010
  • Mathematica
    Select[Range@ 140, SameQ @@ Map[Length, Select[Split@ IntegerDigits[#, 2], First@ # == 1 &]] &] (* Michael De Vlieger, Aug 20 2017 *)
  • Perl
    foreach(1..140){
        %runs=();
        $runs{$}++ foreach split /0+/, sprintf("%b",$);
        print "$_, " if 1==keys(%runs);
    }
    # Ivan Neretin, Nov 09 2015

Extensions

Extended beyond 42 by R. J. Mathar, Feb 27 2010

A245562 Table read by rows: row n gives list of lengths of runs of 1's in binary expansion of n, starting with high-order bits.

Original entry on oeis.org

0, 1, 1, 2, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 3, 4, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 2, 2, 1, 2, 1, 2, 2, 3, 3, 1, 4, 5, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 3, 1, 4, 2, 2, 1
Offset: 0

Views

Author

N. J. A. Sloane, Aug 10 2014

Keywords

Comments

A formula for A071053(n) depends on this table.

Examples

			Here are the run lengths for the numbers 0 through 21:
0, []
1, [1]
2, [1]
3, [2]
4, [1]
5, [1, 1]
6, [2]
7, [3]
8, [1]
9, [1, 1]
10, [1, 1]
11, [1, 2]
12, [2]
13, [2, 1]
14, [3]
15, [4]
16, [1]
17, [1, 1]
18, [1, 1]
19, [1, 2]
20, [1, 1]
21, [1, 1, 1]
		

Crossrefs

Row sums = A000120 (the binary weight).

Programs

  • Maple
    for n from 0 to 128 do
    lis:=[]; t1:=convert(n,base,2); L1:=nops(t1); out1:=1; c:=0;
    for i from 1 to L1 do
       if out1 = 1 and t1[i] = 1 then out1:=0; c:=c+1;
       elif out1 = 0 and t1[i] = 1 then c:=c+1;
       elif out1 = 1 and t1[i] = 0 then c:=c;
       elif out1 = 0 and t1[i] = 0 then lis:=[c,op(lis)]; out1:=1; c:=0;
       fi;
       if i = L1 and c>0 then lis:=[c,op(lis)]; fi;
                       od:
    lprint(n,lis);
    od:
  • PARI
    row(n)=my(v=List(),k); while(n, n>>=valuation(n,2); listput(v, k=valuation(n+1,2)); n>>=k); Vecrev(v) \\ Charles R Greathouse IV, Oct 21 2016
  • Python
    from re import split
    A245562_list = [0]
    for n in range(1,100):
        A245562_list.extend(len(d) for d in split('0+',bin(n)[2:]) if d != '')
    # Chai Wah Wu, Sep 07 2014
    

A384877 Irregular triangle read by rows where row k lists the lengths of maximal anti-runs (increasing by more than 1) in the binary indices of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 3, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 3, 1, 2, 1, 1, 2, 2, 3, 3, 1, 3, 1, 2, 2, 2
Offset: 0

Views

Author

Gus Wiseman, Jun 17 2025

Keywords

Comments

A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.

Examples

			The binary indices of 182 are {2,3,5,6,8}, with maximal anti-runs ((2),(3,5),(6,8)) so row 182 is (1,2,2).
Triangle begins:
   0: ()
   1: (1)
   2: (1)
   3: (1,1)
   4: (1)
   5: (2)
   6: (1,1)
   7: (1,1,1)
   8: (1)
   9: (2)
  10: (2)
  11: (1,2)
  12: (1,1)
  13: (2,1)
  14: (1,1,1)
  15: (1,1,1,1)
		

Crossrefs

Row-sums are A000120.
Positions of rows of the form (1,1,...) are A023758.
Positions of first appearances of each distinct row appear to be A052499.
For runs instead of anti-runs we have A245563, reverse A245562.
Row-lengths are A384890.
A355394 counts partitions without a neighborless part, singleton case A355393.
A356606 counts strict partitions without a neighborless part, complement A356607.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    Table[Length/@Split[bpe[n],#2!=#1+1&],{n,0,100}]

A384890 Number of maximal anti-runs (increasing by more than 1) in the binary indices of n.

Original entry on oeis.org

0, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 1, 2, 3, 2, 2, 2, 3, 3, 3, 4, 5, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 2, 2, 2, 3, 2, 2, 3, 4, 3, 3, 3, 4, 4, 4, 5, 6, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 1, 2
Offset: 0

Views

Author

Gus Wiseman, Jun 17 2025

Keywords

Comments

First differs from A272604 at a(51) = 3, A272604(51) = 2.
A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.
Do all constant runs in this sequence have lengths 1, 2, or 3?

Examples

			The binary indices of 51 are {1,2,5,6}, with maximal anti-runs ((1),(2,5),(6)), so a(51) = 3.
		

Crossrefs

For runs instead of anti-runs we have A069010 = run-lengths of A245563 (reverse A245562).
Row-lengths of A384877, firsts A384878.
For prime indices instead of binary indices we have A384906.
A000120 counts binary indices.
A356606 counts strict partitions without a neighborless part, complement A356607.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    Table[Length[Split[bpe[n],#2!=#1+1&]],{n,0,100}]

A039004 Numbers whose base-4 representation has the same number of 1's and 2's.

Original entry on oeis.org

0, 3, 6, 9, 12, 15, 18, 24, 27, 30, 33, 36, 39, 45, 48, 51, 54, 57, 60, 63, 66, 72, 75, 78, 90, 96, 99, 102, 105, 108, 111, 114, 120, 123, 126, 129, 132, 135, 141, 144, 147, 150, 153, 156, 159, 165, 177, 180, 183, 189, 192, 195, 198, 201, 204, 207, 210, 216, 219
Offset: 1

Views

Author

Keywords

Comments

Numbers such that sum (-1)^k*b(k) = 0 where b(k)=k-th binary digit of n (see A065359). - Benoit Cloitre, Nov 18 2003
Conjecture: a(C(2n,n)-1) = 4^n - 1. (A000984 is C(2n,n)). - Gerald McGarvey, Nov 18 2007
From Russell Jay Hendel, Jun 23 2015: (Start)
We prove the McGarvey conjecture (A) a(e(n,n)-1) = 4^n-1, with e(n,m) = A034870(n,m) = binomial(2n,m), the even rows of Pascal's triangle. By the comment from Hendel in A034870, we have the function s(n,k) = #{n-digit, base-4 numbers with n-k more 1-digits than 2-digits}. As shown in A034870, (B) #s(n,k)= e(n,k) with # indicating cardinality, that is, e(n,k) = binomial(2n,k) gives the number of n-digit, base-4 numbers with n-k more 1-digits than 2-digits.
We now show that (B) implies (A). By definition, s(n,n) contains the e(n,n) = binomial(2n,n) numbers with an equal number of 1-digits and 2-digits. The biggest n-digit, base-4 number is 333...3 (n copies of 3). Since 333...33 has zero 1-digits and zero 2-digits it follows that 333...333 is a member of s(n,n) and hence it is the biggest member of s(n,n). But 333...333 (n copies of 3) in base 4 has value 4^n-1. Since A039004 starts with index 0 (that is, 0 is the 0th member of A039004), it immediately follows that 4^n-1 is the (e(n,n)-1)st member of A039004, proving the McGarvey conjecture. (End)
Also numbers whose alternating sum of binary expansion is 0, i.e., positions of zeros in A345927. These are numbers whose binary expansion has the same number of 1's at even positions as at odd positions. - Gus Wiseman, Jul 28 2021

Crossrefs

A subset of A001969 (evil numbers).
A base-2 version is A031443 (digitally balanced numbers).
Positions of 0's in A065359 and A345927.
Positions of first appearances are A086893.
The version for standard compositions is A344619.
A000120 and A080791 count binary digits, with difference A145037.
A003714 lists numbers with no successive binary indices.
A011782 counts compositions.
A030190 gives the binary expansion of each nonnegative integer.
A070939 gives the length of an integer's binary expansion.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A101211 lists run-lengths in binary expansion:
- row-lengths: A069010
- reverse: A227736
- ones only: A245563
A138364 counts compositions with alternating sum 0:
- bisection: A001700/A088218
- complement: A058622
A328594 lists numbers whose binary expansion is aperiodic.
A345197 counts compositions by length and alternating sum.

Programs

  • Fortran
    c See link in A139351.
  • Maple
    N:= 1000: # to get all terms up to N, which should be divisible by 4
    B:= Array(0..N-1):
    d:= ceil(log[4](N));
    S:= Array(0..N-1,[seq(op([0,1,-1,0]),i=1..N/4)]):
    for i from 1 to d do
      B:= B + S;
      S:= Array(0..N-1,i-> S[floor(i/4)]);
    od:
    select(t -> B[t]=0, [$0..N-1]); # Robert Israel, Jun 24 2015
  • Mathematica
    ats[y_]:=Sum[(-1)^(i-1)*y[[i]],{i,Length[y]}];
    Select[Range[0,100],ats[IntegerDigits[#,2]]==0&] (* Gus Wiseman, Jul 28 2021 *)
  • PARI
    for(n=0,219,if(sum(i=1,length(binary(n)),(-1)^i*component(binary(n),i))==0,print1(n,",")))
    

Formula

Conjecture: there is a constant c around 5 such that a(n) is asymptotic to c*n. - Benoit Cloitre, Nov 24 2002
That conjecture is false. The number of members of the sequence from 0 to 4^d-1 is binomial(2d,d) which by Stirling's formula is asymptotic to 4^d/sqrt(Pi*d). If Cloitre's conjecture were true we would have 4^d-1 asymptotic to c*4^d/sqrt(Pi*d), a contradiction. - Robert Israel, Jun 24 2015

A227736 Irregular table read by rows: the first entry of n-th row is length of run of rightmost identical bits (either 0 or 1, equal to n mod 2), followed by length of the next run of bits, etc., in the binary representation of n, when scanned from the least significant to the most significant end.

Original entry on oeis.org

1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 2, 3, 3, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 3, 4, 4, 1, 1, 3, 1, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 3, 2, 1, 2, 2, 1, 1, 1, 2, 2, 1, 2, 2, 3, 1, 1, 3, 1, 4, 5, 5, 1, 1, 4, 1, 1, 1, 3, 1
Offset: 1

Views

Author

Antti Karttunen, Jul 25 2013

Keywords

Comments

Row n has A005811(n) terms. In rows 2^(k-1)..2^k-1 we have all the compositions (ordered partitions) of k. Other orderings of compositions: A101211 (same with rows reversed), A066099, A108244 and A124734.
Each row n >= 1 contains the initial A005811(n) nonzero terms from the beginning of row n of A227186. A070939(n) gives the sum of terms on row n, while A167489(n) gives the product of its terms. A136480 gives the first column. A101211 lists the terms of each row in reverse order.

Examples

			Table begins as:
  Row  n in    Terms on
   n   binary  that row
   1      1    1;
   2     10    1,1;
   3     11    2;
   4    100    2,1;
   5    101    1,1,1;
   6    110    1,2;
   7    111    3;
   8   1000    3,1;
   9   1001    1,2,1;
  10   1010    1,1,1,1;
  11   1011    2,1,1;
  12   1100    2,2;
  13   1101    1,1,2;
  14   1110    1,3;
  15   1111    4;
  16  10000    4,1;
etc. with the terms of row n appearing in reverse order compared how the runs of the same length appear in the binary expansion of n (Cf. A101211).
From _Omar E. Pol_, Sep 08 2013: (Start)
Illustration of initial terms:
  ---------------------------------------
  k   m     Diagram        Composition
  ---------------------------------------
  .          _
  1   1     |_|_           1;
  2   1     |_| |          1, 1,
  2   2     |_ _|_         2;
  3   1     |_  | |        2, 1,
  3   2     |_|_| |        1, 1, 1,
  3   3     |_|   |        1, 2,
  3   4     |_ _ _|_       3;
  4   1     |_    | |      3, 1,
  4   2     |_|_  | |      1, 2, 1,
  4   3     |_| | | |      1, 1, 1, 1,
  4   4     |_ _|_| |      2, 1, 1,
  4   5     |_  |   |      2, 2,
  4   6     |_|_|   |      1, 1, 2,
  4   7     |_|     |      1, 3,
  4   8     |_ _ _ _|_     4;
  5   1     |_      | |    4, 1,
  5   2     |_|_    | |    1, 3, 1,
  5   3     |_| |   | |    1, 1, 2, 1,
  5   4     |_ _|_  | |    2, 2, 1,
  5   5     |_  | | | |    2, 1, 1, 1,
  5   6     |_|_| | | |    1, 1, 1, 1, 1,
  5   7     |_|   | | |    1, 2, 1, 1,
  5   8     |_ _ _|_| |    3, 1, 1,
  5   9     |_    |   |    3, 2,
  5  10     |_|_  |   |    1, 2, 2,
  5  11     |_| | |   |    1, 1, 1, 2,
  5  12     |_ _|_|   |    2, 1, 2,
  5  13     |_  |     |    2, 3,
  5  14     |_|_|     |    1, 1, 3,
  5  15     |_|       |    1, 4,
  5  16     |_ _ _ _ _|    5;
.
Also irregular triangle read by rows in which row k lists the compositions of k, k >= 1.
Triangle begins:
 [1];
 [1,1], [2];
 [2,1], [1,1,1], [1,2],[3];
 [3,1], [1,2,1], [1,1,1,1], [2,1,1], [2,2], [1,1,2], [1,3], [4];
 [4,1], [1,3,1], [1,1,2,1], [2,2,1], [2,1,1,1], [1,1,1,1,1], [1,2,1,1], [3,1,1], [3,2], [1,2,2], [1,1,1,2], [2,1,2], [2,3], [1,1,3], [1,4], [5];
Row k has length A001792(k-1).
Row sums give A001787(k), k >= 1.
(End)
		

Crossrefs

Cf. A227738 and also A227739 for similar table for unordered partitions.
Cf. A101211 (rows in reversed order).

Programs

  • Haskell
    import Data.List (group)
    a227736 n k = a227736_tabf !! (n-1) !! (k-1)
    a227736_row n = a227736_tabf !! (n-1)
    a227736_tabf = map (map length . group) $ tail a030308_tabf
    -- Reinhard Zumkeller, Aug 11 2014
    
  • Mathematica
    Array[Length /@ Reverse@ Split@ IntegerDigits[#, 2] &, 34] // Flatten (* Michael De Vlieger, Dec 11 2020 *)
  • PARI
    apply( {A227736_row(n, r=[1], b=n%2)=while(n\=2, n%2==b && r[#r]++ || [b=1-b, r=concat(r,1)]); r}, [1..22]) \\ M. F. Hasler, Mar 11 2025
    
  • Python
    def A227736_row(n): return[len(list(g))for _,g in groupby(bin(n)[:1:-1])]
    from itertools import groupby # M. F. Hasler, Mar 11 2025
  • Scheme
    (define (A227736 n) (A227186bi (A227737 n) (A227740 n))) ;; The Scheme-function for A227186bi has been given in A227186.
    

Formula

a(n) = A227186(A227737(n), A227740(n)).
a(n) = A101211(A227741(n)).

A319411 Triangle read by rows: T(n,k) = number of binary vectors of length n with runs-resistance k (1 <= k <= n).

Original entry on oeis.org

2, 2, 2, 2, 2, 4, 2, 4, 6, 4, 2, 2, 12, 12, 4, 2, 6, 30, 18, 8, 0, 2, 2, 44, 44, 32, 4, 0, 2, 6, 82, 76, 74, 16, 0, 0, 2, 4, 144, 138, 172, 52, 0, 0, 0, 2, 6, 258, 248, 350, 156, 4, 0, 0, 0, 2, 2, 426, 452, 734, 404, 28, 0, 0, 0, 0, 2, 10, 790, 752, 1500, 938, 104, 0, 0, 0, 0, 0
Offset: 1

Views

Author

N. J. A. Sloane, Sep 20 2018

Keywords

Comments

"Runs-resistance" is defined in A318928.
Row sums are 2,4,8,16,... (the binary vectors may begin with 0 or 1).
This is similar to A329767 but without the k = 0 column and with a different row n = 1. - Gus Wiseman, Nov 25 2019

Examples

			Triangle begins:
2,
2, 2,
2, 2, 4,
2, 4, 6, 4,
2, 2, 12, 12, 4,
2, 6, 30, 18, 8, 0,
2, 2, 44, 44, 32, 4, 0,
2, 6, 82, 76, 74, 16, 0, 0,
2, 4, 144, 138, 172, 52, 0, 0, 0,
2, 6, 258, 248, 350, 156, 4, 0, 0, 0,
2, 2, 426, 452, 734, 404, 28, 0, 0, 0, 0,
2, 10, 790, 752, 1500, 938, 104, 0, 0, 0, 0, 0,
...
Lenormand gives the first 20 rows.
The calculation of row 4 is as follows.
We may assume the first bit is a 0, and then double the answers.
vector / runs / steps to reach a single number:
0000 / 4 / 1
0001 / 31 -> 11 -> 2 / 3
0010 / 211 -> 12 -> 11 -> 2 / 4
0011 / 22 -> 2 / 2
0100 / 112 -> 21 -> 11 -> 2 / 4
0101 / 1111 -> 4 / 2
0110 / 121 -> 111 -> 3 / 3
0111 / 13 -> 11 -> 2 / 3
and we get 1 (once), 2 (twice), 3 (three times) and 4 (twice).
So row 4 is: 2,4,6,4.
		

Crossrefs

Row sums are A000079.
Column k = 2 is 2 * A032741 = A319410.
Column k = 3 is 2 * A329745 (because runs-resistance 2 for compositions corresponds to runs-resistance 3 for binary words).
The version for compositions is A329744.
The version for partitions is A329746.
The number of nonzero entries in row n > 0 is A319412(n).
The runs-resistance of the binary expansion of n is A318928.

Programs

  • Mathematica
    runsresist[q_]:=If[Length[q]==1,1,Length[NestWhileList[Length/@Split[#]&,q,Length[#]>1&]]-1];
    Table[Length[Select[Tuples[{0,1},n],runsresist[#]==k&]],{n,10},{k,n}] (* Gus Wiseman, Nov 25 2019 *)
Showing 1-10 of 30 results. Next