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.

Previous Showing 11-20 of 22 results. Next

A139370 Let the binary expansion of n be n = Sum_{k} 2^{r_k}, let e(n) be the number of r_k's that are even, o(n) the number that are odd; sequence lists n such that e(n) < o(n).

Original entry on oeis.org

2, 8, 10, 11, 14, 26, 32, 34, 35, 38, 40, 41, 42, 43, 44, 46, 47, 50, 56, 58, 59, 62, 74, 98, 104, 106, 107, 110, 122, 128, 130, 131, 134, 136, 137, 138, 139, 140, 142, 143, 146, 152, 154, 155, 158, 160, 161, 162, 163, 164, 166, 167, 168, 169, 170, 171
Offset: 1

Views

Author

Nadia Heninger and N. J. A. Sloane, Jun 07 2008

Keywords

Comments

e(n)+o(n) = A000120(n), the binary weight of n. For e(n) = o(n) see A039004.
Primes of this sequence are in A065049; but A065049 contains also other primes (see A152715). [Vladimir Shevelev, Dec 11 2008]

Crossrefs

Programs

  • Fortran
    c See link in A139351
    
  • Mathematica
    aQ[n_] := Module[{d = Reverse[IntegerDigits[n,2]]}, Total@d[[1;;-1;;2]] < Total@d[[2;;-1;;2]]]; Select[Range[180], aQ] (* Amiram Eldar, Dec 15 2018 *)
  • PARI
    isok(n) = {my(irb = Vec(select(x->(x%2), Vecrev(binary(n)), 1))); #select(x->(x%2), irb) < #irb/2;} \\ Michel Marcus, Dec 15 2018

A139353 Let the binary expansion of n be n = Sum_{k} 2^{r_k}, let e(n) be the number of r_k's that are even, o(n) the number that are odd; sequence gives e(n)*o(n).

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 1, 2, 0, 1, 0, 2, 1, 2, 2, 4, 0, 0, 1, 2, 0, 0, 2, 3, 1, 2, 2, 4, 2, 3, 4, 6, 0, 1, 0, 2, 1, 2, 2, 4, 0, 2, 0, 3, 2, 4, 3, 6, 1, 2, 2, 4, 2, 3, 4, 6, 2, 4, 3, 6, 4, 6, 6, 9, 0, 0, 1, 2, 0, 0, 2, 3, 1, 2, 2, 4, 2, 3, 4, 6, 0, 0, 2, 3, 0, 0, 3, 4, 2, 3, 4, 6, 3, 4, 6, 8, 1, 2, 2
Offset: 0

Views

Author

Nadia Heninger and N. J. A. Sloane, Jun 07 2008

Keywords

Comments

e(n) + o(n) = A000120(n), the binary weight of n.

Examples

			If n = 43 = 2^0+2^2+2^3+2^5, e(43)=1, o(43)=3.
		

Crossrefs

Programs

  • Fortran
    c See link in A139351
  • Mathematica
    e[0] = 0; e[n_] := e[n] = e[Floor[n/4]] + If[OddQ[Mod[n, 4]], 1, 0];
    o[0] = 0; o[n_] := o[n] = o[Floor[n/4]] + If[Mod[n, 4] > 1, 1, 0];
    a[n_] := e[n] * o[n]; Array[a, 100, 0] (* Amiram Eldar, Jul 18 2023 *)

Formula

a(n) = A139351(n) * A139352(n). - Amiram Eldar, Jul 18 2023

A139354 Let the binary expansion of n be n = Sum_{k} 2^{r_k}, let e(n) be the number of r_k's that are even, o(n) the number that are odd; sequence gives min{e(n), o(n)}.

Original entry on oeis.org

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

Views

Author

Nadia Heninger and N. J. A. Sloane, Jun 07 2008

Keywords

Comments

e(n) + o(n) = A000120(n), the binary weight of n.

Examples

			If n = 43 = 2^0+2^2+2^3+2^5, e(43)=1, o(43)=3.
		

Crossrefs

Programs

  • Fortran
    c See link in A139351
  • Mathematica
    e[0] = 0; e[n_] := e[n] = e[Floor[n/4]] + If[OddQ[Mod[n, 4]], 1, 0];
    o[0] = 0; o[n_] := o[n] = o[Floor[n/4]] + If[Mod[n, 4] > 1, 1, 0];
    a[n_] := Min[e[n], o[n]]; Array[a, 100, 0] (* Amiram Eldar, Jul 18 2023 *)

Formula

a(n) = min(A139351(n), A139352(n)). - Amiram Eldar, Jul 18 2023

A139355 Let the binary expansion of n be n = Sum_{k} 2^{r_k}, let e(n) be the number of r_k's that are even, o(n) the number that are odd; sequence gives max{e(n), o(n)}.

Original entry on oeis.org

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

Views

Author

Nadia Heninger and N. J. A. Sloane, Jun 07 2008

Keywords

Comments

e(n) + o(n) = A000120(n), the binary weight of n.

Examples

			If n = 43 = 2^0+2^2+2^3+2^5, e(43)=1, o(43)=3.
		

Crossrefs

Programs

  • Fortran
    c See link in A139351
  • Mathematica
    e[0] = 0; e[n_] := e[n] = e[Floor[n/4]] + If[OddQ[Mod[n, 4]], 1, 0];
    o[0] = 0; o[n_] := o[n] = o[Floor[n/4]] + If[Mod[n, 4] > 1, 1, 0];
    a[n_] := Max[e[n], o[n]]; Array[a, 100, 0] (* Amiram Eldar, Jul 18 2023 *)

Formula

a(n) = max(A139351(n), A139352(n)). - Amiram Eldar, Jul 18 2023

A139371 Let the binary expansion of n be n = Sum_{k} 2^{r_k}, let e(n) be the number of r_k's that are even, o(n) the number that are odd; sequence lists n such that e(n) <= o(n).

Original entry on oeis.org

0, 2, 3, 6, 8, 9, 10, 11, 12, 14, 15, 18, 24, 26, 27, 30, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 51, 54, 56, 57, 58, 59, 60, 62, 63, 66, 72, 74, 75, 78, 90, 96, 98, 99, 102, 104, 105, 106, 107, 108, 110, 111, 114, 120, 122, 123, 126
Offset: 1

Views

Author

Nadia Heninger and N. J. A. Sloane, Jun 07 2008

Keywords

Comments

e(n)+o(n) = A000120(n), the binary weight of n. For e(n) = o(n) see A039004.

Crossrefs

Programs

  • Fortran
    c See link in A139351
  • Mathematica
    q[n_] := Module[{d = Reverse[IntegerDigits[n, 2]]}, Total@ d[[1;; -1;; 2]] <= Total@ d[[2;; -1;; 2]]]; Select[Range[0, 130], q] (* Amiram Eldar, Aug 31 2023 *)

A139372 Let the binary expansion of n be n = Sum_{k} 2^{r_k}, let e(n) be the number of r_k's that are even, o(n) the number that are odd; sequence lists n such that e(n) >= o(n).

Original entry on oeis.org

0, 1, 3, 4, 5, 6, 7, 9, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 33, 36, 37, 39, 45, 48, 49, 51, 52, 53, 54, 55, 57, 60, 61, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91
Offset: 1

Views

Author

Nadia Heninger and N. J. A. Sloane, Jun 07 2008

Keywords

Comments

e(n)+o(n) = A000120(n), the binary weight of n. For e(n) = o(n) see A039004.

Crossrefs

Programs

  • Fortran
    c See link in A139351
  • Mathematica
    q[n_] := Module[{d = Reverse[IntegerDigits[n, 2]]}, Total@ d[[1;; -1;; 2]] >= Total@ d[[2;; -1;; 2]]]; Select[Range[0, 100], q] (* Amiram Eldar, Aug 31 2023 *)

A139373 Let the binary expansion of n be n = Sum_{k} 2^{r_k}, let e(n) be the number of r_k's that are even, o(n) the number that are odd; sequence lists n such that e(n) > o(n).

Original entry on oeis.org

1, 4, 5, 7, 13, 16, 17, 19, 20, 21, 22, 23, 25, 28, 29, 31, 37, 49, 52, 53, 55, 61, 64, 65, 67, 68, 69, 70, 71, 73, 76, 77, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 91, 92, 93, 94, 95, 97, 100, 101, 103, 109, 112, 113, 115, 116, 117, 118, 119, 121, 124
Offset: 1

Views

Author

Nadia Heninger and N. J. A. Sloane, Jun 07 2008

Keywords

Comments

e(n)+o(n) = A000120(n), the binary weight of n. For e(n) = o(n) see A039004.

Crossrefs

Programs

  • Fortran
    c See link in A139351
    
  • Mathematica
    aQ[n_] := Module[{d = Reverse[IntegerDigits[n,2]]}, Total@d[[1;;-1;;2]] > Total@d[[2;;-1;;2]]]; Select[Range[180], aQ] (* Amiram Eldar, Dec 15 2018 *)
  • PARI
    isok(n) = {my(irb = Vec(select(x->(x%2), Vecrev(binary(n)), 1))); #select(x->(x%2), irb) > #irb/2;} \\ Michel Marcus, Dec 15 2018

A345927 Alternating sum of the binary expansion of n (row n of A030190). Replace 2^k with (-1)^(A070939(n)-k) in the binary expansion of n (compare to the definition of A065359).

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Jul 14 2021

Keywords

Comments

The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i.

Examples

			The binary expansion of 53 is (1,1,0,1,0,1), so a(53) = 1 - 1 + 0 - 1 + 0 - 1 = -2.
		

Crossrefs

Binary expansions of each nonnegative integer are the rows of A030190.
The positions of 0's are A039004.
The version for prime factors is A071321 (reverse: A071322).
Positions of first appearances are A086893.
The version for standard compositions is A124754 (reverse: A344618).
The version for prime multiplicities is A316523.
The version for prime indices is A316524 (reverse: A344616).
A003714 lists numbers with no successive binary indices.
A070939 gives the length of an integer's binary expansion.
A103919 counts partitions by sum and alternating sum.
A328594 lists numbers whose binary expansion is aperiodic.
A328595 lists numbers whose reversed binary expansion is a necklace.

Programs

  • Mathematica
    ats[y_]:=Sum[(-1)^(i-1)*y[[i]],{i,Length[y]}];
    Table[ats[IntegerDigits[n,2]],{n,0,100}]
  • PARI
    a(n) = subst(Pol(Vecrev(binary(n))), x, -1); \\ Michel Marcus, Jul 19 2021
    
  • Python
    def a(n): return sum((-1)**k for k, bi in enumerate(bin(n)[2:]) if bi=='1')
    print([a(n) for n in range(84)]) # Michael S. Branicky, Jul 19 2021

Formula

a(n) = (-1)^(A070939(n)-1)*A065359(n).

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}]

A302544 Lexicographically earliest sequence of distinct nonnegative numbers such that for any n >= 0, A065359(a(n)) = - A065359(n).

Original entry on oeis.org

0, 2, 1, 3, 8, 10, 6, 11, 4, 9, 5, 7, 12, 14, 13, 15, 26, 34, 18, 32, 40, 42, 35, 43, 24, 38, 16, 27, 41, 46, 30, 44, 19, 33, 17, 22, 36, 47, 25, 39, 20, 28, 21, 23, 31, 45, 29, 37, 48, 50, 49, 51, 56, 58, 54, 59, 52, 57, 53, 55, 60, 62, 61, 63, 74, 106, 66
Offset: 0

Views

Author

Rémy Sigrist, Apr 09 2018

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative numbers, with fixed points A039004.
We can build an analog of this sequence for any base b > 1 by considering the alternating sum of digits in base b instead of A065359.
This sequence has similarities with A298847.
The scatter plots have an interesting, "fibrous" look. - Antti Karttunen, Jul 21 2018

Examples

			The first terms, alongside the binary representations of n and of a(n), and A065359(n), are:
  n   a(n)  bin(n)  bin(a(n))  A065359(n)
  --  ----  ------  ---------  ----------
   0     0       0       0      0
   1     2       1      10      1
   2     1      10       1     -1
   3     3      11      11      0
   4     8     100    1000      1
   5    10     101    1010      2
   6     6     110     110      0
   7    11     111    1011      1
   8     4    1000     100     -1
   9     9    1001    1001      0
  10     5    1010     101     -2
  11     7    1011     111     -1
  12    12    1100    1100      0
  13    14    1101    1110      1
  14    13    1110    1101     -1
  15    15    1111    1111      0
  16    26   10000   11010      1
  17    34   10001  100010      2
  18    18   10010   10010      0
  19    32   10011  100000      1
  20    40   10100  101000      2
		

Crossrefs

Cf. A039004 (fixed points), A065359, A298847.
Previous Showing 11-20 of 22 results. Next