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

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

A359359 Sum of positions of zeros in the binary expansion of n, where positions are read starting with 1 from the left (big-endian).

Original entry on oeis.org

1, 0, 2, 0, 5, 2, 3, 0, 9, 5, 6, 2, 7, 3, 4, 0, 14, 9, 10, 5, 11, 6, 7, 2, 12, 7, 8, 3, 9, 4, 5, 0, 20, 14, 15, 9, 16, 10, 11, 5, 17, 11, 12, 6, 13, 7, 8, 2, 18, 12, 13, 7, 14, 8, 9, 3, 15, 9, 10, 4, 11, 5, 6, 0, 27, 20, 21, 14, 22, 15, 16, 9, 23, 16, 17, 10
Offset: 0

Views

Author

Gus Wiseman, Jan 03 2023

Keywords

Examples

			The binary expansion of 100 is (1,1,0,0,1,0,0), with zeros at positions {3,4,6,7}, so a(100) = 20.
		

Crossrefs

The number of zeros is A023416, partial sums A059015.
For positions of 1's we have A230877, reversed A029931.
The reversed version is A359400.
A003714 lists numbers with no successive binary indices.
A030190 gives binary expansion.
A039004 lists the positions of zeros in A345927.

Programs

  • Mathematica
    Table[Total[Join@@Position[IntegerDigits[n,2],0]],{n,0,100}]

Formula

a(n>0) = binomial(A029837(n)+1,2) - A230877(n).

A359400 Sum of positions of zeros in the reversed binary expansion of n, where positions in a sequence are read starting with 1 from the left.

Original entry on oeis.org

1, 0, 1, 0, 3, 2, 1, 0, 6, 5, 4, 3, 3, 2, 1, 0, 10, 9, 8, 7, 7, 6, 5, 4, 6, 5, 4, 3, 3, 2, 1, 0, 15, 14, 13, 12, 12, 11, 10, 9, 11, 10, 9, 8, 8, 7, 6, 5, 10, 9, 8, 7, 7, 6, 5, 4, 6, 5, 4, 3, 3, 2, 1, 0, 21, 20, 19, 18, 18, 17, 16, 15, 17, 16, 15, 14, 14, 13
Offset: 0

Views

Author

Gus Wiseman, Jan 05 2023

Keywords

Examples

			The reversed binary expansion of 100 is (0,0,1,0,0,1,1), with zeros at positions {1,2,4,5}, so a(100) = 12.
		

Crossrefs

The number of zeros is A023416, partial sums A059015.
Row sums of A368494.
For positions of 1's we have A029931, non-reversed A230877.
The non-reversed version is A359359.
A003714 lists numbers with no successive binary indices.
A030190 gives binary expansion, reverse A030308.
A039004 lists the positions of zeros in A345927.

Programs

  • C
    long A359400(long n) {
      long result = 0, counter = 1;
      do {
        if (n % 2 == 0)
          result += counter;
        counter++;
        n /= 2;
      } while (n > 0);
      return result; } // Frank Hollstein, Jan 06 2023
    
  • Mathematica
    Table[Total[Join@@Position[Reverse[IntegerDigits[n,2]],0]],{n,0,100}]
  • Python
    def a(n): return sum(i for i, bi in enumerate(bin(n)[:1:-1], 1) if bi=='0')
    print([a(n) for n in range(78)]) # Michael S. Branicky, Jan 09 2023

Formula

a(n) = binomial(A029837(n)+1, 2) - A029931(n), for n>0.

A372515 Irregular triangle read by rows where row n lists the positions of zeros in the reversed binary expansion of n.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, May 26 2024

Keywords

Examples

			The reversed binary expansion of 100 is (0,0,1,0,0,1,1), with zeros at positions {1,2,4,5}, so row 100 is (1,2,4,5).
Triangle begins:
   1:
   2: 1
   3:
   4: 1 2
   5: 2
   6: 1
   7:
   8: 1 2 3
   9: 2 3
  10: 1 3
  11: 3
  12: 1 2
  13: 2
  14: 1
  15:
  16: 1 2 3 4
		

Crossrefs

Row lengths are A023416, partial sums A059015.
For ones instead of zeros we have A048793, lengths A000120, sums A029931.
Row sums are A359400, non-reversed A359359.
Same as A368494 but with empty rows () instead of (0).
A003714 lists numbers with no successive binary indices.
A030190 gives binary expansion, reverse A030308.
A039004 lists the positions of zeros in A345927.

Programs

  • Mathematica
    Table[Join@@Position[Reverse[IntegerDigits[n,2]],0],{n,30}]

A348552 Number of integer partitions of n with the same alternating product as alternating sum.

Original entry on oeis.org

0, 1, 1, 2, 2, 4, 5, 7, 8, 12, 14, 19, 23, 31, 36, 46, 55, 69, 83, 100, 122, 144, 175, 203, 249, 284, 348, 393, 484, 536, 661, 725, 898, 975, 1208, 1297, 1614, 1715, 2136, 2251, 2812, 2939, 3674, 3813, 4779, 4920, 6172, 6315, 7943, 8070, 10156, 10263, 12944
Offset: 0

Views

Author

Gus Wiseman, Oct 30 2021

Keywords

Comments

The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i. In the case of a partition, this equals the number of odd parts in the conjugate partition.
We define the alternating product of a sequence (y_1,...,y_k) to be Product_i y_i^((-1)^(i-1)).

Examples

			The a(1) = 1 through a(9) = 12 partitions:
  1   2   3     4     5       6       7         8         9
          111   211   221     42      322       332       333
                      311     222     331       422       441
                      11111   411     511       611       522
                              21111   22111     4211      711
                                      31111     22211     22221
                                      1111111   41111     32211
                                                2111111   33111
                                                          51111
                                                          2211111
                                                          3111111
                                                          111111111
For example, we have 3 - 2 + 2 - 1 + 1 = 3 / 2 * 2 / 1 * 1 = 3, so the partition (3,2,2,1,1) is counted under a(9).
		

Crossrefs

The version for reverse-alternating sum (or product, or both) is A025065.
Dominated by A347446.
A000041 counts partitions with alternating sum 0.
A027187 counts partitions of even length.
A027193 counts partitions of odd length, ranked by A026424.
A097805 counts compositions by sum and alternating sum.
A103919 counts partitions by sum and alternating sum (reverse: A344612).
A119620 counts partitions with alternating product 1, ranked by A028982.
A124754 gives alternating sums of standard compositions.
A277103 counts partitions with the same alternating sum as their conjugate.
A345927 gives alternating sums of binary expansions.

Programs

  • Mathematica
    ats[y_]:=Sum[(-1)^(i-1)*y[[i]],{i,Length[y]}];
    altprod[q_]:=Product[q[[i]]^(-1)^(i-1),{i,Length[q]}];
    Table[Length[Select[IntegerPartitions[n],altprod[#]==ats[#]&]],{n,0,30}]
Showing 1-5 of 5 results.