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

A033264 Number of blocks of {1,0} in the binary expansion of n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Number of i such that d(i) < d(i-1), where Sum_{d(i)*2^i: i=0,1,....,m} is base 2 representation of n.
This is the base-2 down-variation sequence; see A297330. - Clark Kimberling, Jan 18 2017

Crossrefs

a(n) = A005811(n) - ceiling(A005811(n)/2) = A005811(n) - A069010(n).
Equals (A072219(n+1)-1)/2.
Cf. also A175047, A030308.
Essentially the same as A087116.

Programs

  • Haskell
    a033264 = f 0 . a030308_row where
       f c [] = c
       f c (0 : 1 : bs) = f (c + 1) bs
       f c (_ : bs) = f c bs
    -- Reinhard Zumkeller, Feb 20 2014, Jun 17 2012
    
  • Maple
    f:= proc(n) option remember; local k;
    k:= n mod 4;
    if k = 2 then procname((n-2)/4) + 1
    elif k = 3 then procname((n-3)/4)
    else procname((n-k)/2)
    fi
    end proc:
    f(1):= 0: f(0):= q:
    seq(f(i),i=1..100); # Robert Israel, Aug 31 2015
  • Mathematica
    Table[Count[Partition[IntegerDigits[n, 2], 2, 1], {1, 0}], {n, 102}] (* Michael De Vlieger, Aug 31 2015, after Robert G. Wilson v at A014081 *)
    Table[SequenceCount[IntegerDigits[n,2],{1,0}],{n,110}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jan 26 2017 *)
  • PARI
    a(n) = { hammingweight(bitand(n>>1, bitneg(n))) }; \\ Gheorghe Coserea, Aug 30 2015
    
  • Python
    def A033264(n): return ((n>>1)&~n).bit_count() # Chai Wah Wu, Jun 25 2025

Formula

G.f.: 1/(1-x) * Sum_(k>=0, t^2/(1+t)/(1+t^2), t=x^2^k). - Ralf Stephan, Sep 10 2003
a(n) = A069010(n) - (n mod 2). - Ralf Stephan, Sep 10 2003
a(4n) = a(4n+1) = a(2n), a(4n+2) = a(n)+1, a(4n+3) = a(n). - Ralf Stephan, Aug 20 2003
a(n) = A087116(n) for n > 0, since strings of 0's alternate with strings of 1's, which end in (1,0). - Jonathan Sondow, Jan 17 2016
Sum_{n>=1} a(n)/(n*(n+1)) = Pi/4 - log(2)/2 (A196521) (Allouche and Shallit, 1990). - Amiram Eldar, Jun 01 2021

A231902 Decimal expansion of Pi/4 + log(2)/2.

Original entry on oeis.org

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

Views

Author

Bruno Berselli, Nov 15 2013

Keywords

Examples

			1.131971753677420964324276906548964005087042417023904082304076152823650...
		

References

  • L. B. W. Jolley, Summation of series, Dover Publications Inc. (New York), 1961, p. 28 (formula 154).
  • Jean-Marie Monier, Analyse, Exercices corrigés, 2ème année MP, Dunod, 1997, Exercice 3.15, p. 269.

Crossrefs

Cf. A003881 (Pi/4), A016655 (10*(log(2)/2)), A072691 (Pi^2/12).
Cf. A006752 (Catalan's constant)
Cf. A196521 (Pi/4-log(2)/2).
Cf. A037800.

Programs

  • Magma
    SetDefaultRealField(RealField(100)); R:=RealField(); (Pi(R) + 2*Log(2))/4; // G. C. Greubel, Aug 24 2018
  • Mathematica
    RealDigits[Pi/4 + Log[2]/2, 10, 90][[1]]
  • PARI
    default(realprecision, 100); (Pi + 2*log(2))/4 \\ G. C. Greubel, Aug 24 2018
    

Formula

Equals 1 + Sum_{m>=1} -(-1)^m/(2*m*(2*m+1)) = 1 + 1/(2*3) - 1/(4*5) + 1/(6*7) - 1/(8*9) + ... .
From Amiram Eldar, Jul 16 2020: (Start)
Equals Integral_{x=1..oo} arctan(x)/x^2 dx.
Equals 1 + Integral_{x=0..1/2} log(4*x^2 + 1) dx. (End)
From Bernard Schott, Sep 07 2020: (Start)
Equals -Sum_{n>=1} (-1)^(n*(n+1)/2) / n [compare with A196521 formula].
Equals Sum_{n>=0} (32*n^2+40*n+11) / (4*(n+1)*(2*n+1)*(4*n+1)*(4*n+3)). (End)
Equals 1 + Sum_{k>=1} A037800(k)/(k*(k+1)) (Allouche and Shallit, 1990). - Amiram Eldar, Jun 01 2021

A307485 A permutation of the nonnegative integers: one odd, two even, four odd, eight even, etc.; extended to nonnegative integer with a(0) = 0.

Original entry on oeis.org

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

Views

Author

M. F. Hasler, Apr 18 2019

Keywords

Comments

The simple idea of "list the first odd number, first two even numbers, next four odd numbers, next eight even numbers..." leads to a permutation of the positive integers, which can quite naturally be extended to a permutation of the nonnegative integers, with a(0) = 0.

Examples

			The first odd number is a(1) = 1,
the first two even numbers are a(2..3) = (2, 4),
the next four odd numbers are a(4..7) = (3, 5, 7, 9),
the next eight even numbers are a(8..15) = (6, 8, ..., 20), etc.
the next sixteen odd numbers are a(16..31) = (11, 13, ..., 41),
the next thirty-two even numbers are a(32..63) = (22, 24, ..., 84), etc.
the next 64 odd numbers are a(64..127) = (43, 45, ..., 169),
the next 128 even numbers are a(128..255) = (86, 88, ..., 340), etc.
		

Crossrefs

Cf. A196521, A307613 (inverse permutation), A307612 (partial sums).
Cf. A103889 (odd & even swapped), A004442 (pairs reversed: n + (-1)^n).
Odd numbers: A005408. Even numbers: A005843.
Cf. A233275 (different permutation based on entangling odd & even numbers).

Programs

  • Mathematica
    Join[{0},Flatten[Riffle[TakeList[Range[1,169,2],2^Range[0,6,2]],TakeList[Range[ 2,340,2],2^Range[ 1,7,2]]]]] (* Harvey P. Dale, Dec 17 2022 *)
  • PARI
    A307485(n)=2*n-2^logint(n<<2+1,2)\3

Formula

Ignoring a(0) = 0, the k-th block (k >= 1) has 2^(k-1) terms, indexed from 2^(k-1) through 2^k-1, all having the same parity as k.
The difference between the last and the first term of this range is: a(2^k-1) - a(2^(k-1)) = 2^k - 2 = (2^(k-1) - 1)*2 = (starting index - 1) times two = ending index minus one.
The 1st, 3rd, ..., (2n+1)-th block = (n+1)-th odd block starts with A007583(n) = (1, 3, 11, 43, 171, ...), n >= 0.
The 2nd, 4th, ..., (2n+2)-th block = (n+1)-th even block starts with 2*A007583(n) = (2, 6, 22, 86, 342, ...), n >= 0, i.e., twice the starting value of the preceding odd block.
a(n) = 2*n - floor(2^k/3) where k = floor(log_2(4n+1)), n >= 0. (And 2^k == (-1)^k (mod 3) => floor(2^k/3) = (2^k-m)/3 with m = 1 if k even, m = 2 if k odd.)
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/4 - log(2)/2 (A196521). - Amiram Eldar, Nov 28 2023

A374157 a(n) = (-1)^floor(n/2)*n.

Original entry on oeis.org

0, 1, -2, -3, 4, 5, -6, -7, 8, 9, -10, -11, 12, 13, -14, -15, 16, 17, -18, -19, 20, 21, -22, -23, 24, 25, -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
Offset: 0

Views

Author

Peter Luschny, Jun 30 2024

Keywords

Comments

For all odd numbers n (A005408) and all whole numbers z (A001057) K(z/n) = K(a(n)/z), where K(z/n) denotes the Kronecker symbol (A372728). This fact is equivalent to the law of quadratic reciprocity and its first and second supplement.

Crossrefs

Programs

  • Maple
    a := n -> (-1)^iquo(n, 2)*n: seq(a(n), n = 0..59);
  • Mathematica
    Array[(-1)^Floor[#/2]*# &, 60, 0] (* Michael De Vlieger, Jun 30 2024 *)
  • PARI
    a(n) = (-1)^(n\2) * n; \\ Amiram Eldar, Jun 30 2024
  • Python
    def A374157(n): return (-1)**(n // 2)*n
    
  • Python
    def A374157(n): return -n if n&2 else n # Chai Wah Wu, Jun 30 2024
    

Formula

Sum_{n>=1} 1/a(n) = Pi/4 - log(2)/2 = A196521.
a(n) = [x^n] -x*(x^2 + 2*x - 1)/(x^2 + 1)^2.
a(n) = n! * [x^n] x*(cos(x) - sin(x)). - Stefano Spezia, Jun 30 2024
a(n) = n*A057077(n). - Michel Marcus, Jul 01 2024

A174091 a(n) = n OR 2.

Original entry on oeis.org

2, 3, 2, 3, 6, 7, 6, 7, 10, 11, 10, 11, 14, 15, 14, 15, 18, 19, 18, 19, 22, 23, 22, 23, 26, 27, 26, 27, 30, 31, 30, 31, 34, 35, 34, 35, 38, 39, 38, 39, 42, 43, 42, 43, 46, 47, 46, 47, 50, 51, 50, 51, 54, 55, 54, 55, 58, 59, 58, 59, 62, 63, 62, 63, 66, 67, 66
Offset: 0

Views

Author

Gary Detlefs, Feb 06 2013

Keywords

Comments

OR(n, 2) + AND(n, 2) = n + 2.
OR(n, 2) - AND(n, 2) = n + 2*(-1)^floor(n/2), A004443.
a(n) = n when n = 2 or 3 mod 4 (n is in A042964). - Alonso del Arte, Feb 07 2013

Examples

			a(3) = 3 because OR(0011, 0010) = 0011 = 3.
a(4) = 6 because OR(0100, 0010) = 0110 = 6.
a(5) = 7 because OR(0101, 0010) = 0111 = 7.
		

Crossrefs

Cf. similar sequences listed in A244587.

Programs

Formula

a(n) = n + 1 + (-1)^floor(n/2).
G.f.: ( 2-x+x^3 ) / ( (1+x^2)*(x-1)^2 ). - R. J. Mathar, Feb 27 2013
Sum_{n>=0} (-1)^n/a(n) = Pi/4 - log(2)/2 = A196521. - Peter McNair, Aug 05 2023

A339799 Decimal expansion of Sum_{m>=1} (-1)^floor(sqrt(m)) / m.

Original entry on oeis.org

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

Views

Author

Bernard Schott, Dec 17 2020

Keywords

Comments

When grouped by negative and positive packs = - (1+1/2+1/3) + (1/4+1/5+1/6+1/7+1/8) - (1/9+...+1/15) + (1/16+...+1/24) +...+ (-1)^k (1/k^2 +...+ 1/((k+1)^2-1)) + ...
Sum_{m>=1} (-1)^floor(sqrt(m)) / m^q is convergent iff q > 1/2.

Examples

			-1.2940812218830910763038217183567312505011225953992043022765923395275517127938...
		

References

  • Jean-Marie Monier, Analyse, Exercices corrigés, 2ème année MP, Dunod, 1997, Exercice 3.3.35, p. 287.
  • E. Ramis , C. Deschamps, J. Odoux, Analyse 2, Exercices avec solutions, Classes Préparatoires aux Grandes Ecoles Scientifiques, Masson, Paris, 1985, Exercice 1. 1.14, pp. 12-13.

Crossrefs

Programs

  • Maple
    evalf(Sum((-1)^n*(Psi(n^2 + 2*n + 1) - Psi(n^2)), n = 1 .. infinity), 120); # Vaclav Kotesovec, Dec 18 2020
  • PARI
    sumalt(k=1, (-1)^k * (psi(1 + 2*k + k^2) - psi(k^2))) \\ Vaclav Kotesovec, Dec 18 2020

Formula

Equals Sum_{m>=1} (-1)^floor(sqrt(m)) / m.
Equals Sum_{m>=1} (-1)^m * Sum_{k=m^2..(m+1)^2-1} 1/k.
Equals Sum_{m>=1} (-1)^m * (digamma((m+1)^2) - digamma(m^2)).

Extensions

More terms from Vaclav Kotesovec, Dec 18 2020

A342316 Decimal expansion of Pi/2 - log(2).

Original entry on oeis.org

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

Views

Author

Peter Luschny, Mar 14 2021

Keywords

Examples

			0.87764914623495130981408957018157487402308456532730...
		

References

  • Jean-Marie Monier, Analyse, Exercices corrigés, 2ème année MP, Dunod, 1997, Exercice 2.5.2.n, pp. 186 and 223.

Crossrefs

Cf. A019669 (Pi/2), A002162 (log(2)), A196521.

Programs

  • Mathematica
    RealDigits[N[Pi/2 - Log[2], 105]][[10]]
  • PARI
    Pi/2 - log(2) \\ Michel Marcus, Mar 14 2021

Formula

Equals (-log(4) - psi(1/4) + psi(3/4)) / 2, where psi(x) denotes the digamma function.
Equals -Integral_{x=0..1} log(x)/((1+x)*sqrt(1-x^2)) dx. - Bernard Schott, Apr 28 2021
Equals Sum_{k>=1} (-1)^(k+1)/(k*(2*k-1)). - Amiram Eldar, Jun 08 2021
From Peter Bala, Mar 05 2024: (Start)
Equals 2 * A196521.
Equals (10/3)*Integral_{x = 0..1} x/(2 - x^2*(1 - x)) dx.
Equals 5*Sum_{n >= 1} 1/(n*binomial(3*n,n)*2^n). The first 10 terms of the series gives the approximate value 0.87764914623(37...), correct to 11 decimal places. (End)
Showing 1-7 of 7 results.