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

A058313 Numerator of the n-th alternating harmonic number, Sum_{k=1..n} (-1)^(k+1)/k.

Original entry on oeis.org

1, 1, 5, 7, 47, 37, 319, 533, 1879, 1627, 20417, 18107, 263111, 237371, 52279, 95549, 1768477, 1632341, 33464927, 155685007, 166770367, 156188887, 3825136961, 3602044091, 19081066231, 18051406831, 57128792093, 7751493599, 236266661971
Offset: 1

Views

Author

N. J. A. Sloane, Dec 09 2000

Keywords

Comments

A Wolstenholme-like theorem: for prime p > 3, if p = 6k-1, then p divides a(4k-1), otherwise if p = 6k+1, then p divides a(4k). - T. D. Noe, Apr 01 2004
For the limit n -> infinity of the partial sums of the alternating harmonic series see A002162. - Wolfdieter Lang, Sep 08 2015
a(n)/A058312(n) appears in the locker puzzle (see the links in A364317) as the probability of failures with the strategy used for n lockers and opening of up to floor(n/2) lockers. Note the alternative formula given below for a(n)/A058312(n) using only positive fractions. - Wolfdieter Lang, Aug 12 2023

Examples

			1, 1/2, 5/6, 7/12, 47/60, 37/60, 319/420, 533/840, 1879/2520, ...
For n=4: a(n)/A058312(n) = 7/12 because 1/1 - 1/2 + 1/3 - 1/4 = 7/12 = 1/4 + 1/3. - _Wolfdieter Lang_, Aug 12 2023
		

References

  • L. B. W. Jolley, Summation of Series, Dover Publications, 1961, page 14, #71.

Crossrefs

Denominators are A058312. Cf. A025530.
Apart from leading term, same as A075830.
Cf. A001008 (numerator of n-th harmonic number).
Bisections are A049281 and A082687.
Cf. A181983.

Programs

  • Haskell
    import Data.Ratio((%), numerator)
    a058313 n = a058313_list !! (n-1)
    a058313_list = map numerator $ scanl1 (+) $ map (1 %) $ tail a181983_list
    -- Reinhard Zumkeller, Mar 20 2013
  • Maple
    A058313 := n->numer(add((-1)^(k+1)/k,k=1..n));
    # Alternatively:
    a := n -> numer(harmonic(n) - harmonic((n-modp(n,2))/2)):
    seq(a(n), n=1..29); # Peter Luschny, May 03 2016
  • Mathematica
    Numerator[Table[Sum[(-1)^(k + 1)/k, {k, n}], {n, 30}]] (* Harvey P. Dale, Jul 18 2012 *)
    a[n_]:= (-1)^n (HarmonicNumber[n/2 - 1/2] - HarmonicNumber[n/2] + (-1)^n Log[4])/2; Table[a[n] // FullSimplify, {n, 29}] // Numerator (* Gerry Martens, Jul 05 2015 *)
    Rest[Numerator[CoefficientList[Series[Log[1 + x]/(1 - x), {x, 0, 33}], x]]] (* Vincenzo Librandi, Jul 06 2015 *)
    Table[Log[2] - (-1)^n LerchPhi[-1, 1, n + 1], {n, 20}] // Numerator (* Eric W. Weisstein, Aug 25 2023 *)
  • PARI
    a(n)=(-1)^n*numerator(polcoeff(log(1-x)/(x+1)+O(x^(n+1)), n))
    

Formula

G.f. for a(n)/A058312(n): log(1+x)/(1-x). - Benoit Cloitre, Jun 15 2003
a(n) = (n*a(n-1) + (-1)^(n+1)*A058312(n-1))/gcd(n*a(n-1) + (-1)^(n+1)*A058312(n-1), n*A058312(n-1)). - Robert Israel, Jul 06 2015
From Peter Luschny, May 03 2016: (Start)
Let H(n) denote the harmonic numbers, AH(n) denote the alternating harmonic numbers, Psi the polygamma function and euler(n,x) the Euler polynomials. Then:
AH(n) = H(n) - H((n - n mod 2)/2).
AH(z) = log(2)+(1/2)*cos(Pi*z)*(Psi(z/2+1/2)-Psi(z/2+1)).
AH(z) ~ log(2)+(1/2)*cos(Pi*z)*(-1/z+1/(2*z^2)-1/(4*z^4)+1/(2*z^6)-...).
AH(z) ~ log(2)-(1/2)*cos(Pi*z)*Sum_{n>=0} Euler(n,0)/z^(n+1). (End)
Sum_{k>=1} (-1)^(k+1)*AH(k)/k = Pi^2/12 + log(2)^2/2 (Boyadzhiev, 2013). - Amiram Eldar, Oct 04 2021
a(n)/A058312(n) = Sum_{j=0..ceiling(n/2) - 1} 1/(n-j), for n >= 1. (Proof by comparing the recurrences for even and odd n.) - Wolfdieter Lang, Aug 12 2023
For n >= 1, log(2) = a(n)/A058312(n) + (-1)^n*n!*Sum_{k >= 1} 1/(k*(k + 1)* ...*(k + n)*2^k). - Peter Bala, Dec 07 2023
a(n) = the (reduced) numerator of the continued fraction 1/(1 + 1^2/(1 + 2^2/(1 + 3^2/(1 + ... + (n-1)^2/(1))))). - Peter Bala, Feb 18 2024

A004442 Natural numbers, pairs reversed: a(n) = n + (-1)^n; also Nimsum n + 1.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

A self-inverse permutation of the natural numbers.
Nonnegative numbers rearranged with least disturbance to maintain a(n) not equal to n. - Amarnath Murthy, Sep 13 2002
Essentially lodumo_2 of A059841. - Philippe Deléham, Apr 26 2009
a(n) = A180176(n) for n >= 20. - Reinhard Zumkeller, Aug 15 2010

References

  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 60.
  • J. H. Conway, On Numbers and Games. Academic Press, NY, 1976, pp. 51-53.

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    import Data.Bits (xor)
    a004442 = xor 1 :: Integer -> Integer
    a004442_list = concat $ transpose [a005408_list, a005843_list]
    -- Reinhard Zumkeller, Jun 23 2013, Feb 01 2013, Oct 20 2011
    
  • Maple
    a[0]:=1:a[1]:=0:for n from 2 to 70 do a[n]:=a[n-2]+2 od: seq(a[n], n=0..68); # Zerinvary Lajos, Feb 19 2008
  • Mathematica
    Table[n + (-1)^n, {n, 0, 72}] (* or *)
    CoefficientList[Series[(1 - x + 2x^2)/((1 - x)(1 - x^2)), {x, 0, 72}], x] (* Robert G. Wilson v, Jun 16 2006 *)
    Flatten[Reverse/@Partition[Range[0,69],2]] (* or *) LinearRecurrence[{1,1,-1},{1,0,3},70] (* Harvey P. Dale, Jul 29 2018 *)
  • PARI
    a(n)=n+(-1)^n \\ Charles R Greathouse IV, Nov 20 2012
    
  • PARI
    Vec((1-x+2*x^2)/((1-x)*(1-x^2)) + O(x^100)) \\ Altug Alkan, Feb 04 2016
    
  • Python
    def a(n): return n^1
    print([a(n) for n in range(69)]) # Michael S. Branicky, Jan 23 2022

Formula

a(n) = n XOR 1. - Odimar Fabeny, Sep 05 2004
G.f.: (1-x+2x^2)/((1-x)*(1-x^2)). - Mitchell Harris, Jan 10 2005
a(n+1) = lod_2(A059841(n)). - Philippe Deléham, Apr 26 2009
a(n) = 2*n - a(n-1) - 1 with n > 0, a(0)=1. - Vincenzo Librandi, Nov 18 2010
a(n) = Sum_{k=1..n-1} (-1)^(n-1-k)*C(n+1,k). - Mircea Merca, Feb 07 2013
For n > 1, a(n)^a(n) == 1 (mod n). - Thomas Ordowski, Jan 04 2016
Sum_{n>=0,n<>1} (-1)^n/a(n) = log(2) = A002162. - Peter McNair, Aug 07 2023

Extensions

Offset adjusted by Reinhard Zumkeller, Mar 05 2010

A002266 Integers repeated 5 times.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

For n > 3, number of consecutive "11's" after the (n+3) "1's" in the continued fraction for sqrt(L(n+2)/L(n)) where L(n) is the n-th Lucas number A000032 (see example). E.g., the continued fraction for sqrt(L(11)/L(9)) is [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 11, 11, 58, 2, 4, 1, ...] with 12 consecutive ones followed by floor(11/5)=2 elevens. - Benoit Cloitre, Jan 08 2006
Complement of A010874, since A010874(n) + 5*a(n) = n. - Hieronymus Fischer, Jun 01 2007
From Paul Curtz, May 13 2020: (Start)
Main N-S vertical of the pentagonal spiral built with this sequence is A001105:
21
20 15 15
20 14 10 10 15
20 14 9 6 6 10 15
20 14 9 5 3 3 6 10 15
20 14 9 5 2 1 1 3 6 10 16
19 14 9 5 2 0 0 0 1 3 6 11 16
19 13 9 5 2 0 0 1 3 7 11 16
19 13 8 5 2 2 1 4 7 11 16
19 13 8 4 4 4 4 7 11 16
19 13 8 8 8 7 7 11 17
18 13 12 12 12 12 12 17
18 18 18 18 17 17 17
The main S-N vertical and the next one are A000217. (End)

Crossrefs

Programs

Formula

a(n) = floor(n/5), n >= 0.
G.f.: x^5/((1-x)(1-x^5)).
a(n) = (n - A010874(n))/5. - Hieronymus Fischer, May 29 2007
For n >= 5, a(n) = floor(log_5(5^a(n-1) + 5^a(n-2) + 5^a(n-3) + 5^a(n-4) + 5^a(n-5))). - Vladimir Shevelev, Jun 22 2010
Sum_{n>=5} (-1)^(n+1)/a(n) = log(2) (A002162). - Amiram Eldar, Sep 30 2022

Extensions

Incorrect formula removed by Ridouane Oudra, Oct 16 2021

A003059 k appears 2k-1 times. Also, square root of n, rounded up.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

n+1 first appears in the sequence at the A002522(n)-th entry (since the ultimate occurrence of n is n^2). a(n) refers to the greatest minimal length of monotone subsequence (i.e.either increasing or decreasing) contained within any sequence of n distinct numbers,according to the Erdős-Szekeres theorem. - Lekraj Beedassy, May 20 2003
With offset 0, apparently the least k such that binomial(2n,n-k) < (1/e) binomial(2n,n). - T. D. Noe, Mar 12 2009
a(n) is the number of nonnegative integer solutions of equation x + y^2 = n - 1. - Ran Pan, Oct 02 2015
Also the burning number of the cycle graph C_n (for n >= 4) and the path graph (for n >= 1). - Eric W. Weisstein, Jan 10 2024

Crossrefs

Programs

  • Haskell
    a003059 n = a003059_list !! (n-1)
    a003059_list = concat $ zipWith ($) (map replicate [1,3..]) [1..]
    -- Reinhard Zumkeller, Mar 18 2011
    
  • Magma
    [Ceiling(Sqrt(n)): n in [1..100]]; // G. C. Greubel, Nov 14 2018
    
  • Maple
    A003059:=n->ceil(sqrt(n)); seq(A003059(k), k=1..100); # Wesley Ivan Hurt, Nov 08 2013
  • Mathematica
    Table[ Table[n, {2n - 1}], {n, 1, 10}] // Flatten (* Jean-François Alcover, Jun 10 2013 *)
    Ceiling[Sqrt[Range[100]]] (* G. C. Greubel, Nov 14 2018 *)
    Table[PadRight[{},2k-1,k],{k,10}]//Flatten (* Harvey P. Dale, Jun 07 2020 *)
  • PARI
    a(n)=if(n<1,0,1+sqrtint(n-1))
    
  • Python
    from math import isqrt
    def A003059(n): return isqrt(n-1)+1 # Chai Wah Wu, Nov 14 2022
  • Sage
    [ceil(sqrt(n)) for n in (1..100)] # G. C. Greubel, Nov 14 2018
    

Formula

a(n) = ceiling(sqrt(n)).
G.f.: (Sum_{n>=0} x^(n^2)) * x/(1-x). - Michael Somos, May 03 2003
a(n) = Sum_{k=0..n-1} A010052(k). - Reinhard Zumkeller, Mar 01 2009
Sum_{n>=1} (-1)^(n+1)/a(n) = log(2) (A002162). - Amiram Eldar, Sep 29 2022

Extensions

Name edited by M. F. Hasler, Nov 13 2018

A016627 Decimal expansion of log(4).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

This constant (negated) is the 1-dimensional analog of Madelung's constant. - Jean-François Alcover, May 20 2014
This constant is the sum over the reciprocals of the hexagonal numbers A000384(n), n >= 1. See the Downey et al. link, and the formula by Robert G. Wilson v below. - Wolfdieter Lang, Sep 12 2016
log(4) - 1 is the mean ratio between the smaller length and the larger length of the two parts of a stick that is being broken at a point that is uniformly chosen at random (Mosteller, 1965). - Amiram Eldar, Jul 25 2020
From Bernard Schott, Sep 11 2020: (Start)
This constant was the subject of the problem B5 during the 42nd Putnam competition in 1981 (see formula Sep 11 2020 and Putnam link).
Jeffrey Shallit generalizes this result obtained for base 2 to any base b (see Amer. Math. Month. link): Sum_{k>=1} digsum(k)_b / (k*(k+1)) = (b/(b-1)) * log(b) where digsum(k)_b is the sum of the digits of k when expressed in base b (for base 10 see A334388). (End)

Examples

			1.38629436111989061883446424291635313615100026872051050824136...
		

References

  • Milton Abramowitz and Irene A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 2.
  • Frederick Mosteller, Fifty challenging problems of probability, Dover, New York, 1965. See problem 42, pp. 10 and 63.
  • Jerome Spanier and Keith B. Oldham, "Atlas of Functions", Hemisphere Publishing Corp., 1987, chapter 2, equation 2:13:8 at page 23.

Crossrefs

Cf. A016732 (continued fraction).
Cf. A002162 (half), A133362 (reciprocal).

Programs

  • Mathematica
    RealDigits[Log@ 4, 10, 111][[1]] (* Robert G. Wilson v, Aug 31 2014 *)
  • PARI
    default(realprecision, 20080); x=log(4); for (n=1, 20000, d=floor(x); x=(x-d)*10; write("b016627.txt", n, " ", d)); \\ Harry J. Smith, May 16 2009, corrected May 19 2009
    
  • PARI
    A016627_vec(N)=digits(floor(log(precision(4.,N))*10^(N-1))) \\ Or: default(realprecision,N);digits(log(4)\.1^N) \\ M. F. Hasler, Oct 20 2013

Formula

log(4) = Sum_{k >= 1} H(k)/2^k where H(k) is the k-th harmonic number. - Benoit Cloitre, Jun 15 2003
Equals 1 - Sum_{k >= 1} (-1)^k/A002378(k) = 1 + 2*Sum_{k >= 0} 1/A069072(k) = 5/4 - Sum_{k >= 1} (-1)^k/A007531(k+2). - R. J. Mathar, Jan 23 2009
Equals 2*A002162 = Sum_{n >= 1} binomial(2*n, n)/(n*4^n) [D. H. Lehmer, Am. Math. Monthly 92 (1985) 449 and Jolley eq. 262]. - R. J. Mathar, Mar 04 2009
log(4) = Sum_{k >= 1} A191907(4, k)/k, (conjecture). - Mats Granvik, Jun 19 2011
log(4) = lim_{n -> infinity} A066066(n)/n. - M. F. Hasler, Oct 20 2013
Equals Sum_{k >= 1} 1/( 2*k^2 - k ). - Robert G. Wilson v, Aug 31 2014
Equals gamma(0, 1/2) - gamma(0, 1) = -(EulerGamma + polygamma(0, 1/2)), where gamma(n,x) denotes the generalized Stieltjes constants, see A020759. - Peter Luschny, May 16 2018
From Amiram Eldar, Jul 25 2020: (Start)
Equals Sum_{k>=1} (3/4)^k/k.
Equals Sum_{k>=1} 1/(k*2^(k-1)) = Sum_{k>=1} 1/A001787(k).
Equals Integral_{x=0..1} log(1+1/x) dx. (End)
Equals Sum_{k>=1} A000120(k) / (k*(k+1)). - Bernard Schott, Sep 11 2020
Equals 1 + Sum_{k>=1} zeta(2*k+1)/4^k. - Amiram Eldar, May 27 2021
Equals Sum_{k>=1} (2*k+1)*Fibonacci(k)/(k*(k+1)*2^k) (Seiffert, 1994). - Amiram Eldar, Jan 15 2022
Continued fraction: log(4) = 1 + 1/(2 + (1*2)/(2 + (2*3)/(2 + (3*4)/(2 + (4*5)/(2 + ... ))))) due to Euler. - Peter Bala, Mar 05 2024
log(4) = 2*Sum_{k>=1} 1/(k*P(k, 5/3)*P(k-1, 5/3)), where P(k, x) denotes the k-th Legendre polynomial. The first 20 terms of the series gives log(4) correct to 18 decimal places. - Peter Bala, Mar 18 2024
Equals Sum_{k>=1} (2*k - 1)!!/(k*(2*k)!!) [Ross] (see Spanier at p. 23). - Stefano Spezia, Dec 27 2024
Equals 1 + Sum_{k>=1} 1/(k*(4*k^2-1)). - Sean A. Irvine, Apr 05 2025
Equals Sum_{k>=1} (12*k^2-1)/(k*(4*k^2-1)^2). - Sean A. Irvine, Apr 06 2025
Equals Integral_{x=0..1} arctanh(sqrt(x))/sqrt(x) dx. - Kritsada Moomuang, Jun 06 2025
From Kritsada Moomuang, Jun 18 2025: (Start)
Equals Integral_{x=0..1} (x^(n - 1)*(x^(3*n) - 1))/log(x) dx, for n > 0.
Equals Integral_{x=0..Pi} sin(x)/(1 + abs(cos(x))) dx. (End)

A002392 Decimal expansion of natural logarithm of 10.

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			2.302585092994045684017991454684364207601101488628772976033327900967572...
		

References

  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See pp. 24, 143.
  • W. E. Mansell, Tables of Natural and Common Logarithms. Royal Society Mathematical Tables, Vol. 8, Cambridge Univ. Press, 1964, p. 2.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • Jerome Spanier and Keith B. Oldham, "Atlas of Functions", Hemisphere Publishing Corp., 1987, chapter 25, pages 227, 232.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, Revised edition 1987. See p. 45.

Crossrefs

Cf. A016738 (continued fraction).

Programs

  • Mathematica
    RealDigits[Log[10],10,120][[1]] (* Harvey P. Dale, Nov 23 2013 *)
  • PARI
    default(realprecision, 20080); x=log(10); for (n=1, 20000, d=floor(x); x=(x-d)*10; write("b002392.txt", n, " ", d)); \\ Harry J. Smith, Apr 16 2009

Formula

Equals A002162 + A016628. - R. J. Mathar, Jul 22 2025

A004524 Three even followed by one odd.

Original entry on oeis.org

0, 0, 0, 1, 2, 2, 2, 3, 4, 4, 4, 5, 6, 6, 6, 7, 8, 8, 8, 9, 10, 10, 10, 11, 12, 12, 12, 13, 14, 14, 14, 15, 16, 16, 16, 17, 18, 18, 18, 19, 20, 20, 20, 21, 22, 22, 22, 23, 24, 24, 24, 25, 26, 26, 26, 27, 28, 28, 28, 29, 30, 30, 30, 31, 32, 32, 32, 33, 34, 34, 34, 35, 36, 36, 36, 37
Offset: 0

Views

Author

Keywords

Comments

Ignoring the first term, for n >= 0, n/2 rounded by the method called "banker's rounding", "statistician's rounding", or "round-to-even" gives 0, 0, 1, 2, 2, 2, 3, ..., where this method rounds k + 0.5 to k if positive integer k is even but rounds k + 0.5 to k + 1 when k + 1 is even. (If the method is indeed defined such that the above statement is also true with the word "positive" removed, then the first 0 term need not be ignored and this sequence can be further extended symmetrically with a(m) = -a(-m) for all integers m, an advantage over usual rounding.) The corresponding sequence for n/2 rounded by the common method is A004526 (considered as beginning with n = -1). - Rick L. Shepherd, Nov 16 2006
From Anthony Hernandez, Aug 08 2016: (Start)
Arrange the positive integers starting at 1 into a triangular array
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
and let e(n) count the even numbers in the n-th row of the array. Then e(n) = a(n+1). For example, e(6) = a(7) = 3 and there are three even numbers in the 6th row of the array. For the count of odd numbers, f(n), look at the sequence A004525. (End)
Also the domination number of the (n-1) X (n-1) white bishop graph. - Eric W. Weisstein, Jun 26 2017
Let (b(n)) be the p-INVERT of A010892 using p(S) = 1 - S^2; then b(n) = a(n+1) for n >= 0. See A292301. - Clark Kimberling, Sep 30 2017
Also the total domination number of the (n-2)-complete graph (for n>3), (n-2)-cycle graph (for n>4), and (n-2)-pan graph (for n>4). - Eric W. Weisstein, Apr 07 2018
The sequence is the interleaving of the duplicated even integers (A052928) with the nonnegative integers (A001477). - Guenther Schrack, Mar 05 2019

Examples

			G.f. = x^3 + 2*x^4 + 2*x^5 + 2*x^6 + 3*x^7 + 4*x^8 + 4*x^9 + 4*x^10 + ...
		

Crossrefs

Zero followed by partial sums of A021913.
First differences of A011848.

Programs

  • GAP
    List([0..79],n->Int(n/4)+Int((n+1)/4)); # Muniru A Asiru, Mar 06 2019
    
  • Haskell
    a004524 n = n `div` 4 + (n + 1) `div` 4
    a004524_list = 0 : 0 : 0 : 1 : map (+ 2) a004524_list
    -- Reinhard Zumkeller, Feb 22 2013, Jul 14 2012
    
  • Magma
    [Floor(n/4)+Floor((n+1)/4) : n in [0..80]]; // Wesley Ivan Hurt, Jul 21 2014
    
  • Maple
    A004524:=n->floor(n/4)+floor((n+1)/4): seq(A004524(n), n=0..50); # Wesley Ivan Hurt, Jul 21 2014
  • Mathematica
    Table[Floor[n/4] + Floor[(n + 1)/4], {n, 0, 80}] (* Wesley Ivan Hurt, Jul 21 2014 *)
    Flatten[Table[{n, n, n, n + 1}, {n, 0, 38, 2}]] (* Alonso del Arte, Aug 10 2016 *)
    Table[(n + Cos[n Pi/2] - 1)/2, {n, 0, 80}] (* Eric W. Weisstein, Apr 07 2018 *)
    Table[Floor[n/2 - 1] + Ceiling[n/4 - 1/2] - Floor[n/4 - 1/2], {n, 0, 80}] (* Eric W. Weisstein, Apr 07 2018 *)
    LinearRecurrence[{2, -2, 2, -1}, {0, 0, 1, 2}, {0, 80}] (* Eric W. Weisstein, Apr 07 2018 *)
    CoefficientList[Series[x^3/((1 - x)^2 (1 + x^2)), {x, 0, 80}], x] (* Eric W. Weisstein, Apr 07 2018 *)
    Table[Round[(n - 1)/2], {n, 0, 20}] (* Eric W. Weisstein, Jun 19 2024 *)
    Round[(Range[0, 20] - 1)/2] (* Eric W. Weisstein, Jun 19 2024 *)
    Table[PadRight[{},If[EvenQ[n],3,1],n],{n,0,40}]//Flatten (* Harvey P. Dale, Dec 11 2024 *)
  • PARI
    {a(n) = n\4 + (n+1)\4}; /* Michael Somos, Jul 19 2003 */
    
  • PARI
    concat([0,0,0], Vec(x^3/((1-x)^2*(1+x^2)) + O(x^80))) \\ Altug Alkan, Oct 31 2015
    
  • Python
    def A004524(n): return (n>>2)+(n+1>>2) # Chai Wah Wu, Jul 29 2022
  • Sage
    [floor(n/4)+floor((n+1)/4) for n in (0..80)] # G. C. Greubel, Mar 08 2019
    

Formula

a(n) = a(n-1) - a(n-2) + a(n-3) + 1 = (n-1) - A004525(n-1). - Henry Bottomley, Mar 08 2000
G.f.: x^3/((1 - x)^2*(1 + x^2)) = x^3*(1 - x^2)/((1 - x)^2*(1 - x^4)). - Michael Somos, Jul 19 2003
If the sequence is extended to negative arguments in the natural way, it satisfies a(n) = -a(2-n) for all n in Z. - Michael Somos, Jul 19 2003
a(n) = A092038(n-3) for n > 4. - Reinhard Zumkeller, Mar 28 2004
From Paul Barry, Oct 27 2004: (Start)
E.g.f.: (exp(x)*(x-1) + cos(x))/2.
a(n) = (n - 1 - cos(Pi*(n-2)/2))/2. (End)
a(n+3) = Sum_{k = 0..n} (1 + (-1)^C(n,2))/2. - Paul Barry, Mar 31 2008
a(n) = floor(n/4) + floor((n+1)/4). - Arkadiusz Wesolowski, Sep 19 2012
From Wesley Ivan Hurt, Jul 21 2014, Oct 31 2015: (Start)
a(n) = Sum_{i = 1..n-1} (floor(i/2) mod 2).
a(n) = n/2 - sqrt(n^2 mod 8)/2. (End)
Euler transform of length 4 sequence [2, -1, 0, 1]. - Michael Somos, Apr 03 2017
a(n) = (2*n - 2 + (1 + (-1)^n)*(-1)^(n*(n-1)/2))/4. - Guenther Schrack, Mar 04 2019
Sum_{n>=3} (-1)^(n+1)/a(n) = log(2) (A002162). - Amiram Eldar, Sep 29 2022

A118324 (Greedy) Egyptian fraction expansion of log 2.

Original entry on oeis.org

2, 6, 38, 6071, 144715221, 58600453312405245, 28261174043083404192255923187258021, 1350299665604204277005894785275782053022737307184211775676631561245153
Offset: 1

Views

Author

Eric W. Weisstein, Apr 23 2006

Keywords

Examples

			log(2) = 1/2 + 1/6 + 1/38 + 1/6071 + 1/144715221 + ...
		

Crossrefs

Cf. A002162 (log(2)).

Programs

Extensions

a(8) from Jaume Oliver Lafont, Feb 24 2009

A132747 a(n) = number of non-isolated divisors of n.

Original entry on oeis.org

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

Views

Author

Leroy Quet, Aug 27 2007

Keywords

Comments

A divisor d of n is non-isolated if either d-1 or d+1 divides n. a(2n-1) = 0 for all n >= 1.

Examples

			The positive divisors of 20 are 1,2,4,5,10,20. Of these, 1 and 2 are next to each other and 4 and 5 are next to each other. So a(20) = the number of these divisors, which is 4.
		

Crossrefs

Programs

  • Mathematica
    Table[Length[Select[Divisors[n], If[ # > 1, IntegerQ[n/(#*(# - 1))]] || IntegerQ[n/(#*(# + 1))] &]], {n, 1, 90}] (* Stefan Steinerberger, Oct 26 2007 *)
  • PARI
    a(n) = my(div = divisors(n)); sumdiv(n, d, vecsearch(div, d-1) || vecsearch(div, d+1)); \\ Michel Marcus, Aug 22 2014

Formula

a(n) = A000005(n) - A132881(n).
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = log(2) + 1 = A002162 + 1 = 1.693147.... . - Amiram Eldar, Mar 22 2024

Extensions

More terms from Stefan Steinerberger, Oct 26 2007
Extended by Ray Chandler, Jun 24 2008

A152901 Decimal expansion of log_24 (2).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Oct 30 2009

Keywords

Examples

			0.21810429198553155922933780644338838862766042549949976761473...
		

Crossrefs

Cf. decimal expansion of log_24(m): this sequence, A153100 (m=3), A153200 (m=4), A153458 (m=5), A153614 (m=6), A153736 (m=7), A154007 (m=8), A154116 (m=9), A154174 (m=10), A154195 (m=11), A154216 (m=12), A154461 (m=13), A154538 (m=14), A154735 (m=15), A154846 (m=16), A154904 (m=17), A154994 (m=18), A155168 (m=19), A155535 (m=20), A155692 (m=21), A155792 (m=22), A155920 (m=23).

Programs

Formula

A002162 divided by A016647. - R. J. Mathar, Mar 22 2011
Previous Showing 11-20 of 263 results. Next