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.

A037861 (Number of 0's) - (number of 1's) in the base-2 representation of n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

-Sum_{n>=1} a(n)/((2*n)*(2*n+1)) = the "alternating Euler constant" log(4/Pi) = 0.24156... - (see A094640 and Sondow 2005, 2010).
a(A072600(n)) < 0; a(A072601(n)) <= 0; a(A031443(n)) = 0; a(A072602(n)) >= 0; a(A072603(n)) > 0; a(A031444(n)) = 1; a(A031448(n)) = -1; abs(a(A089648(n))) <= 1. - Reinhard Zumkeller, Feb 07 2015

Crossrefs

Cf. A031443 for n when a(n)=0, A053738 for n when a(n) odd, A053754 for n when a(n) even, A030300 for a(n+1) mod 2.
See A268289 for a recurrence based on this sequence.

Programs

  • Haskell
    a037861 n = a023416 n - a000120 n  -- Reinhard Zumkeller, Aug 01 2013
    
  • Maple
    A037861:= proc(n) local L;
         L:= convert(n,base,2);
         numboccur(0,L) - numboccur(1,L)
    end proc:
    map(A037861, [$0..100]); # Robert Israel, Mar 08 2016
  • Mathematica
    Table[Count[ IntegerDigits[n, 2], 0] - Count[IntegerDigits[n, 2], 1], {n, 0, 75}]
  • PARI
    a(n) = if (n==0, 1, 1 + logint(n, 2) - 2*hammingweight(n)); \\ Michel Marcus, May 15 2020 and Jun 16 2020
  • Python
    def A037861(n):
        return 2*format(n,'b').count('0')-len(format(n,'b')) # Chai Wah Wu, Mar 07 2016
    

Formula

From Henry Bottomley, Oct 27 2000: (Start)
a(n) = A023416(n) - A000120(n) = A029837(n) - 2*A000120(n) = 2*A023416(n) - A029837(n).
a(2*n) = a(n) + 1; a(2*n + 1) = a(2*n) - 2 = a(n) - 1. (End)
G.f. satisfies A(x) = (1 + x)*A(x^2) - x*(2 + x)/(1 + x). - Franklin T. Adams-Watters, Dec 26 2006
a(n) = b(n) for n > 0 with b(0) = 0 and b(n) = b(floor(n/2)) + (-1)^(n mod 2). - Reinhard Zumkeller, Dec 31 2007
G.f.: 1 + (1/(1 - x))*Sum_{k>=0} x^(2^k)*(x^(2^k) - 1)/(1 + x^(2^k)). - Ilya Gutkovskiy, Apr 07 2018

A094640 Decimal expansion of the "alternating Euler constant" log(4/Pi).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Decimal expansion of Sum_{n>=1} (-1)^{n-1} (1/n - log(1 + 1/n)) (see Sondow 2005), so in comparison to A001620's sum formula, log(4/Pi) is an "alternating Euler constant."

Examples

			log(4/Pi) = 0.24156447527...
		

References

  • George Boros and Victor Moll, Irresistible Integrals: Symbolics, Analysis and Experiments in the Evaluation of Integrals, Cambridge University Press, Cambridge, 2004, Chap. 7.
  • Jonathan Borwein and Peter Borwein, Pi and the AGM, John Wiley & Sons, New York, 1987, Chap. 11.

Crossrefs

Programs

  • Magma
    SetDefaultRealField(RealField(100)); R:= RealField(); Log(4/Pi(R)); // G. C. Greubel, Aug 28 2018
  • Mathematica
    RealDigits[ Log[4/Pi], 10, 111][[1]]
  • PARI
    log(4/Pi) \\ Charles R Greathouse IV, Jun 06 2011
    

Formula

Equals Integral_{x=0..1, y=0..1} (x-1)/((1+x*y)*log(x*y)). (see Sondow 2005).
Equals -Integral_{x=0..1} (1-x)^2 dx/((1+x^2)*log(x)). - Amiram Eldar, Jun 29 2020
From Petros Hadjicostas, Jun 29 2020: (Start)
Equals Integral_{x=0..1} (1 - x + log(x))/((1 + x)*log(x)) dx. (Let u = x*y and v = y in Sondow's double integral and integrate w.r.t. v.)
Equals Integral_{x=0..1, y=0..1} (1 - x*y)^2/((1 + x^2*y^2)*(log(x*y))^2). (Apply Glasser's (2019) Theorem 1 on Amiram Eldar's integral above.) (End)
Equals Integral_{0..Pi/2} (sec(t)-2/(Pi-2*t)) dt. - Clark Kimberling, Jul 10 2020
Equals -Sum_{k>=1} log(1 - 1/(2*k+1)^2). - Amiram Eldar, Jul 06 2023

A110626 Denominator of b(n) = -Sum_{k=1..n} A037861(k)/((2*k)*(2*k+1)), where A037861(k) = (number of 0's) - (number of 1's) in the binary representation of k.

Original entry on oeis.org

6, 6, 14, 504, 27720, 360360, 360360, 765765, 765765, 765765, 1601145, 1601145, 369495, 3061530, 94907430, 16703707680, 116925953760, 4326260289120, 1068586291412640, 43812037947918240, 1883917631760484320
Offset: 1

Views

Author

Jonathan Sondow, Aug 01 2005

Keywords

Comments

Denominators of partial sums of a series for the "alternating Euler constant" log(4/Pi) (see A094640 and Sondow 2005, 2010). Numerators are A110625.

Examples

			a(3) = 14 because b(3) = 1/6 + 0 + 1/21 = 3/14.
The first few fractions b(n) are 1/6, 1/6, 3/14, 101/504, 5807/27720, 77801/360360, 82949/360360, ... = A110625/A110626. - _Petros Hadjicostas_, May 15 2020
		

Crossrefs

Programs

  • PARI
    a(n) = denominator(-sum(k=1, n, (#binary(k) - 2*hammingweight(k))/(2*k*(2*k+1))));\\ Petros Hadjicostas, May 15 2020

Formula

Lim_{n -> infinity} b(n) = log 4/Pi = 0.24156...

A126388 Denominators in a series for the "alternating Euler constant" log(4/Pi).

Original entry on oeis.org

2, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 22, 23, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 72, 73, 78, 79, 80, 81, 86, 87, 90, 91, 92
Offset: 2

Views

Author

Jonathan Sondow, Jan 01 2007

Keywords

Comments

All n > 1 such that (# of 1's) != (# of 0's) in the base 2 expansion of floor(n/2). The numerators of the series are A126389.

Examples

			floor(13/2) = 6 = 110 base 2, which has (# of 1's) = 2 != 1 = (#
of 0's), so 13 is a member.
		

Crossrefs

Complementary to A066879.

Programs

  • Mathematica
    b[n_] := DigitCount[n,2,1] - DigitCount[n,2,0]; L = {}; Do[If[b[Floor[n/2]] != 0, L = Append[L,n]], {n,2,100}]; L

Formula

log(4/Pi) = 1/2 - 1/3 + 2/6 - 2/7 - 1/8 + 1/9 + 1/10 - 1/11 + 1/12 - 1/13 + 3/14 - 3/15 - 2/16 + 2/17 + 2/22 - ...

A126389 Numerators in a series for the "alternating Euler constant" log(4/Pi).

Original entry on oeis.org

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

Views

Author

Jonathan Sondow, Jan 01 2007

Keywords

Comments

Nonzero values of (-1)^n*b(floor(n/2)) for n > 1, where b(n) = (# of 1's) - (# of 0's) in the base 2 expansion of n. The denominators of the series are A126388.

Examples

			floor(15/2) = 7 = 111 base 2, which has (# of 1's) - (# of 0's) = 3, so (-1)^15*3 = -3 is a term.
		

Crossrefs

Programs

  • Mathematica
    b[n_] := DigitCount[n,2,1] - DigitCount[n,2,0]; L = {}; Do[If[b[Floor[n/2]] != 0, L = Append[L,(-1)^n*b[Floor[n/2]]]], {n,2,100}]; L

Formula

Log(4/Pi) = 1/2 - 1/3 + 2/6 - 2/7 - 1/8 + 1/9 + 1/10 - 1/11 + 1/12 - 1/13 + 3/14 - 3/15 - 2/16 + 2/17 + 2/22 - ...
Showing 1-5 of 5 results.