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-10 of 48 results. Next

A000326 Pentagonal numbers: a(n) = n*(3*n-1)/2.

Original entry on oeis.org

0, 1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330, 376, 425, 477, 532, 590, 651, 715, 782, 852, 925, 1001, 1080, 1162, 1247, 1335, 1426, 1520, 1617, 1717, 1820, 1926, 2035, 2147, 2262, 2380, 2501, 2625, 2752, 2882, 3015, 3151
Offset: 0

Views

Author

Keywords

Comments

The average of the first n (n > 0) pentagonal numbers is the n-th triangular number. - Mario Catalani (mario.catalani(AT)unito.it), Apr 10 2003
a(n) is the sum of n integers starting from n, i.e., 1, 2 + 3, 3 + 4 + 5, 4 + 5 + 6 + 7, etc. - Jon Perry, Jan 15 2004
Partial sums of 1, 4, 7, 10, 13, 16, ... (1 mod 3), a(2k) = k(6k-1), a(2k-1) = (2k-1)(3k-2). - Jon Perry, Sep 10 2004
Starting with offset 1 = binomial transform of [1, 4, 3, 0, 0, 0, ...]. Also, A004736 * [1, 3, 3, 3, ...]. - Gary W. Adamson, Oct 25 2007
If Y is a 3-subset of an n-set X then, for n >= 4, a(n-3) is the number of 4-subsets of X having at least two elements in common with Y. - Milan Janjic, Nov 23 2007
Solutions to the duplication formula 2*a(n) = a(k) are given by the index pairs (n, k) = (5,7), (5577, 7887), (6435661, 9101399), etc. The indices are integer solutions to the pair of equations 2(6n-1)^2 = 1 + y^2, k = (1+y)/6, so these n can be generated from the subset of numbers [1+A001653(i)]/6, any i, where these are integers, confined to the cases where the associated k=[1+A002315(i)]/6 are also integers. - R. J. Mathar, Feb 01 2008
a(n) is a binomial coefficient C(n,4) (A000332) if and only if n is a generalized pentagonal number (A001318). Also see A145920. - Matthew Vandermast, Oct 28 2008
Even octagonal numbers divided by 8. - Omar E. Pol, Aug 18 2011
Sequence found by reading the line from 0, in the direction 0, 5, ... and the line from 1, in the direction 1, 12, ..., in the square spiral whose vertices are the generalized pentagonal numbers A001318. - Omar E. Pol, Sep 08 2011
The hyper-Wiener index of the star-tree with n edges (see A196060, example). - Emeric Deutsch, Sep 30 2011
More generally the n-th k-gonal number is equal to n + (k-2)*A000217(n-1), n >= 1, k >= 3. In this case k = 5. - Omar E. Pol, Apr 06 2013
Note that both Euler's pentagonal theorem for the partition numbers and Euler's pentagonal theorem for the sum of divisors refer more exactly to the generalized pentagonal numbers, not this sequence. For more information see A001318, A175003, A238442. - Omar E. Pol, Mar 01 2014
The Fuss-Catalan numbers are Cat(d,k)= [1/(k*(d-1)+1)]*binomial(k*d,k) and enumerate the number of (d+1)-gon partitions of a (k*(d-1)+2)-gon (cf. Schuetz and Whieldon link). a(n)= Cat(n,3), so enumerates the number of (n+1)-gon partitions of a (3*(n-1)+2)-gon. Analogous sequences are A100157 (k=4) and A234043 (k=5). - Tom Copeland, Oct 05 2014
Binomial transform of (0, 1, 3, 0, 0, 0, ...) (A169585 with offset 1) and second partial sum of (0, 1, 3, 3, 3, ...). - Gary W. Adamson, Oct 05 2015
For n > 0, a(n) is the number of compositions of n+8 into n parts avoiding parts 2 and 3. - Milan Janjic, Jan 07 2016
a(n) is also the number of edges in the Mycielskian of the complete graph K[n]. Indeed, K[n] has n vertices and n(n-1)/2 edges. Then its Mycielskian has n + 3n(n-1)/2 = n(3n-1)/2. See p. 205 of the West reference. - Emeric Deutsch, Nov 04 2016
Sum of the numbers from n to 2n-1. - Wesley Ivan Hurt, Dec 03 2016
Also the number of maximal cliques in the n-Andrásfai graph. - Eric W. Weisstein, Dec 01 2017
Coefficients in the hypergeometric series identity 1 - 5*(x - 1)/(2*x + 1) + 12*(x - 1)*(x - 2)/((2*x + 1)*(2*x + 2)) - 22*(x - 1)*(x - 2)*(x - 3)/((2*x + 1)*(2*x + 2)*(2*x + 3)) + ... = 0, valid for Re(x) > 1. Cf. A002412 and A002418. Column 2 of A103450. - Peter Bala, Mar 14 2019
A generalization of the Comment dated Apr 10 2003 follows. (k-3)*A000292(n-2) plus the average of the first n (2k-1)-gonal numbers is the n-th k-gonal number. - Charlie Marion, Nov 01 2020
a(n+1) is the number of Dyck paths of size (3,3n+1); i.e., the number of NE lattice paths from (0,0) to (3,3n+1) which stay above the line connecting these points. - Harry Richman, Jul 13 2021
a(n) is the largest sum of n positive integers x_1, ..., x_n such that x_i | x_(i+1)+1 for each 1 <= i <= n, where x_(n+1) = x_1. - Yifan Xie, Feb 21 2025

Examples

			Illustration of initial terms:
.
.                                       o
.                                     o o
.                          o        o o o
.                        o o      o o o o
.                o     o o o    o o o o o
.              o o   o o o o    o o o o o
.        o   o o o   o o o o    o o o o o
.      o o   o o o   o o o o    o o o o o
.  o   o o   o o o   o o o o    o o o o o
.
.  1    5     12       22           35
- _Philippe Deléham_, Mar 30 2013
		

References

  • Tom M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, pages 2 and 311.
  • Raymond Ayoub, An Introduction to the Analytic Theory of Numbers, Amer. Math. Soc., 1963; p. 129.
  • Albert H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, p. 189.
  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See pp. 38, 40.
  • E. Deza and M. M. Deza, Figurate numbers, World Scientific Publishing (2012), page 6.
  • L. E. Dickson, History of the Theory of Numbers. Carnegie Institute Public. 256, Washington, DC, Vol. 1, 1919; Vol. 2, 1920; Vol. 3, 1923, see vol. 2, p. 1.
  • Jan Gullberg, Mathematics from the Birth of Numbers, W. W. Norton & Co., NY & London, 1997, §8.6 Figurate Numbers, p. 291.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 284.
  • Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 64.
  • Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, pages 52-53, 129-130, 132.
  • 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).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 7-10.
  • André Weil, Number theory: an approach through history; from Hammurapi to Legendre, Birkhäuser, Boston, 1984; see p. 186.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, 1987, pp. 98-100.
  • Douglas B. West, Introduction to Graph Theory, 2nd ed., Prentice-Hall, NJ, 2001.

Crossrefs

The generalized pentagonal numbers b*n+3*n*(n-1)/2, for b = 1 through 12, form sequences A000326, A005449, A045943, A115067, A140090, A140091, A059845, A140672, A140673, A140674, A140675, A151542.
Cf. A001318 (generalized pentagonal numbers), A049452, A033570, A010815, A034856, A051340, A004736, A033568, A049453, A002411 (partial sums), A033579.
See A220083 for a list of numbers of the form n*P(s,n)-(n-1)*P(s,n-1), where P(s,n) is the n-th polygonal number with s sides.
Cf. A240137: sum of n consecutive cubes starting from n^3.
Cf. similar sequences listed in A022288.
Partial sums of A016777.

Programs

  • GAP
    List([0..50],n->n*(3*n-1)/2); # Muniru A Asiru, Mar 18 2019
    
  • Haskell
    a000326 n = n * (3 * n - 1) `div` 2  -- Reinhard Zumkeller, Jul 07 2012
    
  • Magma
    [n*(3*n-1)/2 : n in [0..100]]; // Wesley Ivan Hurt, Oct 15 2015
    
  • Maple
    A000326 := n->n*(3*n-1)/2: seq(A000326(n), n=0..100);
    A000326:=-(1+2*z)/(z-1)**3; # Simon Plouffe in his 1992 dissertation
    a[0]:=0:a[1]:=1:for n from 2 to 50 do a[n]:=2*a[n-1]-a[n-2]+3 od: seq(a[n], n=0..50); # Miklos Kristof, Zerinvary Lajos, Feb 18 2008
  • Mathematica
    Table[n (3 n - 1)/2, {n, 0, 60}] (* Stefan Steinerberger, Apr 01 2006 *)
    Array[# (3 # - 1)/2 &, 47, 0] (* Zerinvary Lajos, Jul 10 2009 *)
    LinearRecurrence[{3, -3, 1}, {0, 1, 5}, 61] (* Harvey P. Dale, Dec 27 2011 *)
    pentQ[n_] := IntegerQ[(1 + Sqrt[24 n + 1])/6]; pentQ[0] = True; Select[Range[0, 3200], pentQ@# &] (* Robert G. Wilson v, Mar 31 2014 *)
    Join[{0}, Accumulate[Range[1, 312, 3]]] (* Harvey P. Dale, Mar 26 2016 *)
    (* For Mathematica 10.4+ *) Table[PolygonalNumber[RegularPolygon[5], n], {n, 0, 46}] (* Arkadiusz Wesolowski, Aug 27 2016 *)
    CoefficientList[Series[x (-1 - 2 x)/(-1 + x)^3, {x, 0, 20}], x] (* Eric W. Weisstein, Dec 01 2017 *)
    PolygonalNumber[5, Range[0, 20]] (* Eric W. Weisstein, Dec 01 2017 *)
  • PARI
    a(n)=n*(3*n-1)/2
    
  • PARI
    vector(100, n, n--; binomial(3*n, 2)/3) \\ Altug Alkan, Oct 06 2015
    
  • PARI
    is_a000326(n) = my(s); n==0 || (issquare (24*n+1, &s) && s%6==5); \\ Hugo Pfoertner, Aug 03 2023
    
  • Python
    # Intended to compute the initial segment of the sequence, not isolated terms.
    def aList():
         x, y = 1, 1
         yield 0
         while True:
             yield x
             x, y = x + y + 3, y + 3
    A000326 = aList()
    print([next(A000326) for i in range(47)]) # Peter Luschny, Aug 04 2019

Formula

Product_{m > 0} (1 - q^m) = Sum_{k} (-1)^k*x^a(k). - Paul Barry, Jul 20 2003
G.f.: x*(1+2*x)/(1-x)^3.
E.g.f.: exp(x)*(x+3*x^2/2).
a(n) = n*(3*n-1)/2.
a(-n) = A005449(n).
a(n) = binomial(3*n, 2)/3. - Paul Barry, Jul 20 2003
a(n) = A000290(n) + A000217(n-1). - Lekraj Beedassy, Jun 07 2004
a(0) = 0, a(1) = 1; for n >= 2, a(n) = 2*a(n-1) - a(n-2) + 3. - Miklos Kristof, Mar 09 2005
a(n) = Sum_{k=1..n} (2*n - k). - Paul Barry, Aug 19 2005
a(n) = 3*A000217(n) - 2*n. - Lekraj Beedassy, Sep 26 2006
a(n) = A126890(n, n-1) for n > 0. - Reinhard Zumkeller, Dec 30 2006
a(n) = A049452(n) - A022266(n) = A033991(n) - A005476(n). - Zerinvary Lajos, Jun 12 2007
Equals A034856(n) + (n - 1)^2. Also equals A051340 * [1,2,3,...]. - Gary W. Adamson, Jul 27 2007
a(n) = binomial(n+1, 2) + 2*binomial(n, 2).
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3), a(0) = 0, a(1) = 1, a(2) = 5. - Jaume Oliver Lafont, Dec 02 2008
a(n) = a(n-1) + 3*n-2 with n > 0, a(0)=0. - Vincenzo Librandi, Nov 20 2010
a(n) = A000217(n) + 2*A000217(n-1). - Vincenzo Librandi, Nov 20 2010
a(n) = A014642(n)/8. - Omar E. Pol, Aug 18 2011
a(n) = A142150(n) + A191967(n). - Reinhard Zumkeller, Jul 07 2012
a(n) = (A000290(n) + A000384(n))/2 = (A000217(n) + A000566(n))/2 = A049450(n)/2. - Omar E. Pol, Jan 11 2013
a(n) = n*A000217(n) - (n-1)*A000217(n-1). - Bruno Berselli, Jan 18 2013
a(n) = A005449(n) - n. - Philippe Deléham, Mar 30 2013
From Oskar Wieland, Apr 10 2013: (Start)
a(n) = a(n+1) - A016777(n),
a(n) = a(n+2) - A016969(n),
a(n) = a(n+3) - A016777(n)*3 = a(n+3) - A017197(n),
a(n) = a(n+4) - A016969(n)*2 = a(n+4) - A017641(n),
a(n) = a(n+5) - A016777(n)*5,
a(n) = a(n+6) - A016969(n)*3,
a(n) = a(n+7) - A016777(n)*7,
a(n) = a(n+8) - A016969(n)*4,
a(n) = a(n+9) - A016777(n)*9. (End)
a(n) = A000217(2n-1) - A000217(n-1), for n > 0. - Ivan N. Ianakiev, Apr 17 2013
a(n) = A002411(n) - A002411(n-1). - J. M. Bergot, Jun 12 2013
Sum_{n>=1} a(n)/n! = 2.5*exp(1). - Richard R. Forberg, Jul 15 2013
a(n) = floor(n/(exp(2/(3*n)) - 1)), for n > 0. - Richard R. Forberg, Jul 27 2013
From Vladimir Shevelev, Jan 24 2014: (Start)
a(3*a(n) + 4*n + 1) = a(3*a(n) + 4*n) + a(3*n+1).
A generalization. Let {G_k(n)}_(n >= 0) be sequence of k-gonal numbers (k >= 3). Then the following identity holds: G_k((k-2)*G_k(n) + c(k-3)*n + 1) = G_k((k-2)*G_k(n) + c(k-3)*n) + G_k((k-2)*n + 1), where c = A000124. (End)
A242357(a(n)) = 1 for n > 0. - Reinhard Zumkeller, May 11 2014
Sum_{n>=1} 1/a(n)= (1/3)*(9*log(3) - sqrt(3)*Pi). - Enrique Pérez Herrero, Dec 02 2014. See the decimal expansion A244641.
a(n) = (A000292(6*n+k-1)-A000292(k))/(6*n-1)-A000217(3*n+k), for any k >= 0. - Manfred Arens, Apr 26 2015 [minor edits from Wolfdieter Lang, May 10 2015]
a(n) = A258708(3*n-1,1) for n > 0. - Reinhard Zumkeller, Jun 23 2015
a(n) = A007584(n) - A245301(n-1), for n > 0. - Manfred Arens, Jan 31 2016
Sum_{n>=1} (-1)^(n+1)/a(n) = 2*(sqrt(3)*Pi - 6*log(2))/3 = 0.85501000622865446... - Ilya Gutkovskiy, Jul 28 2016
a(m+n) = a(m) + a(n) + 3*m*n. - Etienne Dupuis, Feb 16 2017
In general, let P(k,n) be the n-th k-gonal number. Then P(k,m+n) = P(k,m) + (k-2)mn + P(k,n). - Charlie Marion, Apr 16 2017
a(n) = A023855(2*n-1) - A023855(2*n-2). - Luc Rousseau, Feb 24 2018
a(n) = binomial(n,2) + n^2. - Pedro Caceres, Jul 28 2019
Product_{n>=2} (1 - 1/a(n)) = 3/5. - Amiram Eldar, Jan 21 2021
(n+1)*(a(n^2) + a(n^2+1) + ... + a(n^2+n)) = n*(a(n^2+n+1) + ... + a(n^2+2n)). - Charlie Marion, Apr 28 2024
a(n) = Sum_{k = 0..3*n} (-1)^(n+k+1) * binomial(k, 2)*binomial(3*n+k-1, 2*k). - Peter Bala, Nov 04 2024

Extensions

Incorrect example removed by Joerg Arndt, Mar 11 2010

A007691 Multiply-perfect numbers: n divides sigma(n).

Original entry on oeis.org

1, 6, 28, 120, 496, 672, 8128, 30240, 32760, 523776, 2178540, 23569920, 33550336, 45532800, 142990848, 459818240, 1379454720, 1476304896, 8589869056, 14182439040, 31998395520, 43861478400, 51001180160, 66433720320, 137438691328, 153003540480, 403031236608
Offset: 1

Views

Author

Keywords

Comments

sigma(n)/n is in A054030.
Also numbers such that the sum of the reciprocals of the divisors is an integer. - Harvey P. Dale, Jul 24 2001
Luca's solution of problem 11090, which proves that for k>1 there are an infinite number of n such that n divides sigma_k(n), does not apply to this sequence. However, it is conjectured that this sequence is also infinite. - T. D. Noe, Nov 04 2007
Numbers k such that sigma(k) is divisible by all divisors of k, subsequence of A166070. - Jaroslav Krizek, Oct 06 2009
A017666(a(n)) = 1. - Reinhard Zumkeller, Apr 06 2012
Bach, Miller, & Shallit show that this sequence can be recognized in polynomial time with arbitrarily small error by a probabilistic Turing machine; that is, this sequence is in BPP. - Charles R Greathouse IV, Jun 21 2013
Conjecture: If n is such that 2^n-1 is in A066175 then a(n) is a triangular number. - Ivan N. Ianakiev, Aug 26 2013
Conjecture: Every multiply-perfect number is practical (A005153). I've verified this conjecture for the first 5261 terms with abundancy > 2 using Achim Flammenkamp's data. The even perfect numbers are easily shown to be practical, but every practical number > 1 is even, so a weak form says every even multiply-perfect number is practical. - Jaycob Coleman, Oct 15 2013
Numbers such that A054024(n) = 0. - Michel Marcus, Nov 16 2013
Numbers n such that k(n) = A229110(n) = antisigma(n) mod n = A024816(n) mod n = A000217(n) mod n = (n(n+1)/2) mod n = A142150(n). k(n) = n/2 for even n; k(n) = 0 for odd n (for number 1 and eventually odd multiply-perfect numbers n > 1). - Jaroslav Krizek, May 28 2014
The only terms m > 1 of this sequence that are not in A145551 are m for which sigma(m)/m is not a divisor of m. Conjecture: after 1, A323653 lists all such m (and no other numbers). - Antti Karttunen, Mar 19 2021

Examples

			120 is OK because divisors of 120 are {1,2,3,4,5,6,8,10,12,15,20,24,30,40,60,120}, the sum of which is 360=120*3.
		

References

  • A. H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, p. 22.
  • J. Roberts, Lure of the Integers, Math. Assoc. America, 1992, p. 176.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • I. Stewart, L'univers des nombres, "Les nombres multiparfaits", Chapter 15, pp. 82-88, Belin-Pour La Science, Paris 2000.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 141-148.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, 1987, pp. 135-136.

Crossrefs

Complement is A054027. Cf. A000203, A054030.
Cf. A000396, A005820, A027687, A046060, A046061, for subsequences of terms with quotient sigma(n)/n = 2..6.
Subsequence of the following sequences: A011775, A071707, A083865, A089748 (after the initial 1), A102783, A166070, A175200, A225110, A226476, A237719, A245774, A246454, A259307, A263928, A282775, A323652, A336745, A340864. Also conjectured to be a subsequence of A005153, of A307740, and after 1 also of A295078.
Various number-theoretical functions applied to these numbers: A088843 [tau], A098203 [phi], A098204 [gcd(a(n),phi(a(n)))], A134665 [2-adic valuation], A307741 [sigma], A308423 [product of divisors], A320024 [the odd part], A134740 [omega], A342658 [bigomega], A342659 [smallest prime not dividing], A342660 [largest prime divisor].
Positions of ones in A017666, A019294, A094701, A227470, of zeros in A054024, A082901, A173438, A272008, A318996, A326194, A341524. Fixed points of A009194.
Cf. A069926, A330746 (left inverses, when applied to a(n) give n).
Cf. (other related sequences) A007539, A066135, A066961, A093034, A094467, A134639, A145551, A019278, A194771 [= 2*a(n)], A219545, A229110, A262432, A335830, A336849, A341608.

Programs

  • Haskell
    a007691 n = a007691_list !! (n-1)
    a007691_list = filter ((== 1) . a017666) [1..]
    -- Reinhard Zumkeller, Apr 06 2012
    
  • Mathematica
    Do[If[Mod[DivisorSigma[1, n], n] == 0, Print[n]], {n, 2, 2*10^11}] (* or *)
    Transpose[Select[Table[{n, DivisorSigma[-1, n]}, {n, 100000}], IntegerQ[ #[[2]] ]& ] ][[1]]
    (* Third program: *)
    Select[Range[10^6], IntegerQ@ DivisorSigma[-1, #] &] (* Michael De Vlieger, Mar 19 2021 *)
  • PARI
    for(n=1,1e6,if(sigma(n)%n==0, print1(n", ")))
    
  • Python
    from sympy import divisor_sigma as sigma
    def ok(n): return sigma(n, 1)%n == 0
    print([n for n in range(1, 10**4) if ok(n)]) # Michael S. Branicky, Jan 06 2021

Extensions

More terms from Jud McCranie and then from David W. Wilson.
Incorrect comment removed and the crossrefs-section reorganized by Antti Karttunen, Mar 20 2021

A001057 Canonical enumeration of integers: interleaved positive and negative integers with zero prepended.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Go forwards and backwards with increasing step sizes. - Daniele Parisse and Franco Virga, Jun 06 2005
The partial sums of the divergent series 1 - 2 + 3 - 4 + ... give this sequence. Euler summed it to 1/4 which was one of the first examples of summing divergent series. - Michael Somos, May 22 2007
From Peter Luschny, Jul 12 2009: (Start)
The general formula for alternating sums of powers is in terms of the Swiss-Knife polynomials P(n,x) A153641 2^(-n-1)(P(n,1)-(-1)^k P(n,2k+1)). Thus
a(k) = 2^(-2)(P(1,1)-(-1)^k P(1,2k+1)). (End)
Let A be the Hessenberg matrix of order n, defined by: A[1,j]=1, A[i,i]:=-1, A[i,i-1]=-1, and A[i,j]=0 otherwise. Then, for n>=4, a(n-3)=(-1)^(n-1)*coeff(charpoly(A,x),x). - Milan Janjic, Jan 26 2010
Cantor ordering of the integers producing a 1-1 and onto correspondence between the natural numbers and the integers showing that the set Z of integers has the same cardinality as the set N of natural numbers. The cardinal of N is the first transfinite cardinal aleph_null (or aleph_naught), which is the cardinality of a given infinite set if and only if it is countably infinite (denumerable), i.e., it can be put in 1-1 and onto correspondence (with a proper Cantor ordering) with the natural numbers. - Daniel Forgues, Jan 23 2010
a(n) is the determinant of the (n+2) X (n+2) (0,1)-Toeplitz matrix M satisfying: M(i,j)=0 iff i=j or i=j-1. The matrix M arises in the variation of ménage problem where not a round table, but one side of a rectangular table is considered (see comments of Vladimir Shevelev in A000271). Namely M(i,j) defines the class of permutations p of 1,2,...,n+2 such that p(i)<>i and p(i)<>i+1 for i=1,2,...,n+1, and p(n+2)<>n+2. And a(n) is also the difference between the number of even and odd such permutations. - Dmitry Efimov, Mar 02 2017

Examples

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

Crossrefs

Cf. A008619, A004526, A166711, A166871, A130472 (negation), A142150 (partial sums), A010551 (partial products for n > 0).
Alternating row sums of A104578 are a(n+1), for n >= 0.

Programs

  • Haskell
    a001057 n = (n' + m) * (-1) ^ (1 - m) where (n',m) = divMod n 2
    a001057_list = 0 : concatMap (\x -> [x,-x]) [1..]
    -- Reinhard Zumkeller, Apr 02 2012
    
  • Maple
    a := n -> (1-(-1)^n*(2*n+1))/4; # Peter Luschny, Jul 12 2009
  • Mathematica
    Join[{0},Riffle[Range[35],-Range[35]]] (* Harvey P. Dale, Sep 21 2011 *)
    a[ n_] := -(-1)^n Ceiling[n/2]; (* Michael Somos, Jun 05 2013 *)
    LinearRecurrence[{-1, 1, 1}, {0, 1, -1}, 63] (* Jean-François Alcover, Jan 07 2019 *)
  • PARI
    {a(n) = if( n%2, n\2 + 1, -n/2)}; /* Michael Somos, Jul 20 1999 */
    
  • Python
    def a(n): return n//2 + 1 if n%2 else -n//2
    print([a(n) for n in range(63)]) # Michael S. Branicky, Jul 14 2022

Formula

Euler transform of [-1, 2] is sequence a(n+1). - Michael Somos, Jun 11 2003
G.f.: x / ((1 + x) * (1 - x^2)). - Michael Somos, Jul 20 1999
E.g.f.: (exp(x) - (1 - 2*x) * exp(-x)) / 4. - Michael Somos, Jun 11 2003
a(n) = 1 - 2*a(n-1) -a(n-2); a(2*n) = -n, a(2*n+1) = n+1. - Michael Somos, Jul 20 1999
|a(n+1)| = A008619(n). |a(n-1)| = A004526(n). - Michael Somos, Jul 20 1999
a(n) = -a(n-1) + a(n-2) + a(n-3). a(n) = (-1)^(n+1) * floor((n+1) / 2). - Michael Somos, Jun 11 2003
a(1) = 1, a(n) = a(n-1)+n or a(n-1)-n whichever is closer to 0 on the number line. Or abs(a(n)) = min{abs(a(n-1)+n), abs(a(n-1)-n)}. - Amarnath Murthy, Jul 01 2003
a(n) = Sum_{k=0..n} k*(-1)^(k+1). - Paul Barry, Aug 20 2003
a(n) = (1-(2n+1)*(-1)^n)/4. - Paul Barry, Feb 02 2004
a(0) = 0; a(n) = (-1)^(n-1) * (n-|a(n-1)|) for n >= 1. - Rick L. Shepherd, Jul 14 2004
a(n) = a(n-1)-n*(-1)^n, a(0)=0; or a(n) = -a(n-1)+(1-(-1)^n)/2, a(0)=0. - Daniele Parisse and Franco Virga, Jun 06 2005
a(n) = ceiling(n/2) * (-1)^(n+1), n >= 0. - Franklin T. Adams-Watters, Nov 25 2011 (corrected by Daniel Forgues, Jul 21 2012)
a(n) = a(-1-n) for all n in Z. - Michael Somos, Jun 05 2013
Sum_{n>=1} 1/a(n) = 0. - Jaume Oliver Lafont, Jul 14 2017

Extensions

Thanks to Michael Somos for helpful comments.
Name edited by Franklin T. Adams-Watters, Jan 30 2012

A008805 Triangular numbers repeated.

Original entry on oeis.org

1, 1, 3, 3, 6, 6, 10, 10, 15, 15, 21, 21, 28, 28, 36, 36, 45, 45, 55, 55, 66, 66, 78, 78, 91, 91, 105, 105, 120, 120, 136, 136, 153, 153, 171, 171, 190, 190, 210, 210, 231, 231, 253, 253, 276, 276, 300, 300, 325, 325, 351, 351, 378, 378, 406, 406, 435, 435
Offset: 0

Views

Author

Keywords

Comments

Number of choices for nonnegative integers x,y,z such that x and y are even and x + y + z = n.
Diagonal sums of A002260, when arranged as a number triangle. - Paul Barry, Feb 28 2003
a(n) = number of partitions of n+4 such that the differences between greatest and smallest parts are 2: a(n-4) = A097364(n,2) for n>3. - Reinhard Zumkeller, Aug 09 2004
For n >= i, i=4,5, a(n-i) is the number of incongruent two-color bracelets of n beads, i from them are black (cf. A005232, A032279), having a diameter of symmetry. - Vladimir Shevelev, May 03 2011
Prefixing A008805 by 0,0,0,0 gives the sequence c(0), c(1), ... defined by c(n)=number of (w,x,y) such that w = 2x+2y, where w,x,y are all in {1,...,n}; see A211422. - Clark Kimberling, Apr 15 2012
Partial sums of positive terms of A142150. - Reinhard Zumkeller, Jul 07 2012
The sum of the first parts of the nondecreasing partitions of n+2 into exactly two parts, n >= 0. - Wesley Ivan Hurt, Jun 08 2013
Number of the distinct symmetric pentagons in a regular n-gon, see illustration for some small n in links. - Kival Ngaokrajang, Jun 25 2013
a(n) is the number of nonnegative integer solutions to the equation x + y + z = n such that x + y <= z. For example, a(4) = 6 because we have 0+0+4 = 0+1+3 = 0+2+2 = 1+0+3 = 1+1+2 = 2+0+2. - Geoffrey Critzer, Jul 09 2013
a(n) is the number of distinct opening moves in n X n tic-tac-toe. - I. J. Kennedy, Sep 04 2013
a(n) is the number of symmetry-allowed, linearly-independent terms at n-th order in the series expansion of the T2 X t2 vibronic perturbation matrix, H(Q) (cf. Opalka & Domcke). - Bradley Klee, Jul 20 2015
a(n-1) also gives the number of D_4 (dihedral group of order 4) orbits of an n X n square grid with squares coming in either of two colors and only one square has one of the colors. - Wolfdieter Lang, Oct 03 2016
Also, this sequence is the third column in the triangle of the coefficients of the sum of two consecutive Fibonacci polynomials F(n+1, x) and F(n, x) (n>=0) in ascending powers of x. - Mohammad K. Azarian, Jul 18 2018
In an n-person symmetric matching pennies game (a zero-sum normal-form game) with n > 2 symmetric and indistinguishable players, each with two strategies (viz. heads or tails), a(n-3) is the number of distinct subsets of players that must play the same strategy to avoid incurring losses (single pure Nash equilibrium in the reduced game). The total number of distinct partitions is A000217(n-1). - Ambrosio Valencia-Romero, Apr 17 2022
a(n) is the number of connected bipartite graphs with n+1 edges and a stable set of cardinality 2. - Christian Barrientos, Jun 15 2022
a(n) is the number of 132-avoiding odd Grassmannian permutations of size n+2. - Juan B. Gil, Mar 10 2023
Consider a regular n-gon with all diagonals drawn. Define a "layer" to be the set of all regions sharing an edge with the exterior. Removing a layer creates another layer. Count the layers, removing them until none remain. The number of layers is a(n-2). See illustration. - Christopher Scussel, Nov 07 2023

Examples

			a(5) = 6, since (5) + 2 = 7 has three nondecreasing partitions with exactly 2 parts: (1,6),(2,5),(3,4). The sum of the first parts of these partitions = 1 + 2 + 3 = 6. - _Wesley Ivan Hurt_, Jun 08 2013
		

References

  • H. D. Brunk, An Introduction to Mathematical Statistics, Ginn, Boston, 1960; p. 360.

Crossrefs

Cf. A000217, A002260, A002620, A006918 (partial sums), A054252, A135276, A142150, A158920 (binomial trans.).

Programs

  • GAP
    List([0..60], n-> (2*n +3 +(-1)^n)*(2*n +7 +(-1)^n)/32); # G. C. Greubel, Sep 12 2019
    
  • Haskell
    import Data.List (transpose)
    a008805 = a000217 . (`div` 2) . (+ 1)
    a008805_list = drop 2 $ concat $ transpose [a000217_list, a000217_list]
    -- Reinhard Zumkeller, Feb 01 2013
    
  • Magma
    [(2*n+3+(-1)^n)*(2*n+7+(-1)^n)/32 : n in [0..50]]; // Wesley Ivan Hurt, Apr 22 2015
    
  • Maple
    A008805:=n->(2*n+3+(-1)^n)*(2*n+7+(-1)^n)/32: seq(A008805(n), n=0..50); # Wesley Ivan Hurt, Apr 22 2015
  • Mathematica
    CoefficientList[Series[1/(1-x^2)^2/(1-x), {x, 0, 50}], x]
    Table[Binomial[Floor[n/2] + 2, 2], {n, 0, 57}] (* Michael De Vlieger, Oct 03 2016 *)
  • PARI
    a(n)=(n\2+2)*(n\2+1)/2
    
  • Python
    def A008805(n): return (m:=(n>>1)+1)*(m+1)>>1 # Chai Wah Wu, Oct 20 2023
  • Sage
    [(2*n +3 +(-1)^n)*(2*n +7 +(-1)^n)/32 for n in (0..60)] # G. C. Greubel, Sep 12 2019
    

Formula

G.f.: 1/((1-x)*(1-x^2)^2) = 1/((1+x)^2*(1-x)^3).
E.g.f.: (exp(x)*(2*x^2 +12*x+ 11) - exp(-x)*(2*x -5))/16.
a(-n) = a(-5+n).
a(n) = binomial(floor(n/2)+2, 2). - Vladimir Shevelev, May 03 2011
From Paul Barry, May 31 2003: (Start)
a(n) = ((2*n +5)*(-1)^n + (2*n^2 +10*n +11))/16.
a(n) = Sum_{k=0..n} ((k+2)*(1+(-1)^k))/4. (End)
From Paul Barry, Apr 16 2005: (Start)
a(n) = Sum_{k=0..n} floor((k+2)/2)*(1-(-1)^(n+k-1))/2.
a(n) = Sum_{k=0..floor(n/2)} floor((n-2k+2)/2). (End)
A signed version is given by Sum_{k=0..n} (-1)^k*floor(k^2/4). - Paul Barry, Aug 19 2003
a(n) = A108299(n-2,n)*(-1)^floor((n+1)/2) for n>1. - Reinhard Zumkeller, Jun 01 2005
a(n) = A004125(n+3) - A049798(n+2). - Carl Najafi, Jan 31 2013
a(n) = Sum_{i=1..floor((n+2)/2)} i. - Wesley Ivan Hurt, Jun 08 2013
a(n) = (1/2)*floor((n+2)/2)*(floor((n+2)/2)+1). - Wesley Ivan Hurt, Jun 08 2013
From Wesley Ivan Hurt, Apr 22 2015: (Start)
a(n) = a(n-1) +2*a(n-2) -2*a(n-3) -a(n-4) +a(n-5).
a(n) = (2*n +3 +(-1)^n)*(2*n +7 +(-1)^n)/32. (End)
a(n-1) = A054252(n,1) = A054252(n^2-1), n >= 1. See a Oct 03 2016 comment above. - Wolfdieter Lang, Oct 03 2016
a(n) = A000217(A008619(n)). - Guenther Schrack, Sep 12 2018
From Ambrosio Valencia-Romero, Apr 17 2022: (Start)
a(n) = a(n-1) if n odd, a(n) = a(n-1) + (n+2)/2 if n is even, for n > 0, a(0) = 1.
a(n) = (n+1)*(n+3)/8 if n odd, a(n) = (n+2)*(n+4)/8 if n is even, for n >= 0.
a(n) = A002620(n+2) - a(n-1), for n > 0, a(0) = 1.
a(n) = A142150(n+2) + a(n-1), for n > 0, a(0) = 1.
a(n) = A000217(n+3)/2 - A135276(n+3)/2. (End)

A121262 The characteristic function of the multiples of four.

Original entry on oeis.org

1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0
Offset: 0

Views

Author

Paolo P. Lava and Giorgio Balzarotti, Aug 23 2006, Aug 30 2007

Keywords

Comments

Period 4: repeat [1, 0, 0, 0].
a(n) is also the number of partitions of n where each part is four (Since the empty partition has no parts, a(0) = 1). Hence a(n) is also the number of 2-regular graphs on n vertices such that each component has girth exactly four. - Jason Kimberley, Oct 01 2011
This sequence is the Euler transformation of A185014. - Jason Kimberley, Oct 01 2011
Number of permutations satisfying -k <= p(i) - i <= r and p(i)-i not in I, i = 1..n, with k = 1, r = 3, I = {0, 1, 2}. - Vladimir Baltic, Mar 07 2012

References

  • G. Balzarotti and P. P. Lava, Le sequenze di numeri interi, Hoepli, 2008, p. 82.

Crossrefs

A011765 is another version of the same sequence.
Characteristic function of multiples of g: A000007 (g=0), A000012 (g=1), A059841 (g=2), A079978 (g=3), this sequence (g=4), A079998 (g=5), A079979 (g=6), A082784 (g=7). - Jason Kimberley, Oct 14 2011

Programs

Formula

a(n) = (1/4)*(2*cos(n*Pi/2) + 1 + (-1)^n).
Additive with a(p^e) = 1 if p = 2 and e > 1, 0 otherwise.
Sequence shifted right by 2 is additive with a(p^e) = 1 if p = 2 and e = 1, 0 otherwise.
a(n) = 1 - (C(n + 1, n + (-1)^(n+1)) mod 2).
a(n) = 0^(n mod 4). - Reinhard Zumkeller, Sep 30 2008
a(n) = !(n%4). - Jaume Oliver Lafont, Mar 01 2009
a(n) = (1/4)*(1 + I^n + (-1)^n + (-I)^n). - Paolo P. Lava, May 04 2010
a(n) = ((n-1)^k mod 4 - (n-1)^(k-1) mod 4)/2, k > 2. - Gary Detlefs, Feb 21 2011
a(n) = floor(1/2*cos(n*Pi/2) + 1/2). - Gary Detlefs, May 16 2011
G.f.: 1/(1 - x^4); a(n) = (1 + (-1)^n)*(1 + i^((n-1)*n))/4, where i = sqrt(-1). - Bruno Berselli, Sep 28 2011
a(n) = floor(((n+3) mod 4)/3). - Gary Detlefs, Dec 29 2011
a(n) = floor(n/4) - floor((n-1)/4). - Tani Akinari, Oct 25 2012
a(n) = ceiling( (1/2)*cos(Pi*n/2) ). - Wesley Ivan Hurt, May 31 2013
a(n) = ((1+(-1)^(n/2))*(1+(-1)^n))/4. - Bogart B. Strauss, Jul 14 2013
a(n) = C(n-1,3) mod 2. - Wesley Ivan Hurt, Oct 07 2014
a(n) = (((n+1) mod 4) mod 3) mod 2. - Ctibor O. Zizka, Dec 11 2014
a(n) = (sin(Pi*(n+1)/2)^2)/2 + sin(Pi*(n+1)/2)/2. - Mikael Aaltonen, Jan 02 2015
E.g.f.: (cos(x) + cosh(x))/2. - Vaclav Kotesovec, Feb 15 2015
a(n) = a(n-4) for n>3. - Wesley Ivan Hurt, Jul 07 2016
a(n) = (1-sqrt(2)*cos(n*Pi/2-3*Pi/4))/2 * cos(n*Pi/2). - (found by Steve Chow) Iain Fox, Nov 16 2017
a(n) = 1-A166486(n). - Antti Karttunen, Jul 29 2018
a(n) = (1-(-1)^A142150(n+1))/2. - Adriano Caroli, Sep 28 2019

Extensions

More terms from Antti Karttunen, Jul 29 2018

A127648 Triangle read by rows: row n consists of n zeros followed by n+1.

Original entry on oeis.org

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

Views

Author

Gary W. Adamson, Jan 22 2007

Keywords

Comments

Alternatively, a(n) = k if n+1 is the k-th triangular number and 0 otherwise.
Triangle T(n,k), 0<=k<=n, read by rows, given by (0,0,0,0,0,0,0,0,0,0,...) DELTA (2,-1/2,1/2,0,0,0,0,0,0,0,...) where DELTA is the operator defined in A084938. - Philippe Deléham, Oct 27 2011

Examples

			First few rows of the triangle:
  1;
  0, 2;
  0, 0, 3;
  0, 0, 0, 4;
  0, 0, 0, 0, 5;
  0, 0, 0, 0, 0, 6;
  0, 0, 0, 0, 0, 0, 7;
  ...
		

Crossrefs

Programs

  • Haskell
    a127648 n k = a127648_tabl !! n !! k
    a127648_row n = a127648_tabl !! n
    a127648_tabl = map reverse $ iterate (\(x:xs) -> x + 1 : 0 : xs) [1]
    a127648_list = concat a127648_tabl
    -- Reinhard Zumkeller, Jul 13 2013
    
  • Magma
    [k eq n select n+1 else 0: k in [0..n], n in [0..20]]; // G. C. Greubel, Mar 12 2024
    
  • Maple
    A127648 := proc(n)
        for i from 0 do
            if A000217(i) = n+1 then
                return i ;
            elif A000217(i) >n then
                return 0 ;
            end if;
        end do;
    end proc: # R. J. Mathar, Apr 23 2013
  • Mathematica
    Flatten[Table[{n,Table[0,{n}]},{n,15}]] (* Harvey P. Dale, Jul 27 2011 *)
  • PARI
    A127648(n) = if(ispolygonal(1+n,3), (sqrtint(1+((1+n)*8))-1)/2, 0); \\ Antti Karttunen, Jan 19 2025
  • Python
    for i in range(1,15):
        print(i, end=", ")
        for j in range(i):
            print("0", end=", ") # Mohammad Saleh Dinparvar, May 11 2020
    
  • Python
    from math import isqrt
    from sympy.ntheory.primetest import is_square
    def A127648(n): return (m:=isqrt(k:=n<<1))+(k>m*(m+1)) if is_square((n<<3)+1) else 0 # Chai Wah Wu, Jun 09 2025
    
  • SageMath
    def A127648(n): return (sqrt(9+8*n)-1)//2 if ((sqrt(9+8*n)-3)/2).is_integer() else 0
    [A127648(n) for n in range(153)] # G. C. Greubel, Mar 12 2024
    

Formula

Infinite lower triangular matrix with (1, 2, 3, ...) in the main diagonal and the rest zeros.
This sequence * A007318 (Pascal's Triangle) = A003506.
A007318 * this sequence = A103406.
G.f.: 1/(x*y-1)^2. - R. J. Mathar, Aug 11 2015
a(n) = (1/2) (round(sqrt(4 + 2 n)) - round(sqrt(2 + 2 n))) (-1 + round(sqrt(2 + 2 n)) + round(sqrt(4 + 2 n))). - Brian Tenneson, Jan 27 2017
From G. C. Greubel, Mar 13 2024: (Start)
T(n, n) = n+1.
Sum_{k=0..n} T(n, k) = n+1.
Sum_{k=0..n} (-1)^k*T(n, k) = (-1)^n*(n+1).
Sum_{k=0..floor(n/2)} T(n-k, k) = A142150(n+2).
Sum_{k=0..floor(n/2)} (-1)^k*T(n-k, k) = (-1)^floor(n/2)*A142150(n+2). (End)

A027656 Expansion of 1/(1-x^2)^2 (included only for completeness - the policy is always to omit the zeros from such sequences).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(n) is the number of nonnegative integer solutions to the equation x+y+z=n such that x+y=z. - Geoffrey Critzer, Jul 12 2013

Crossrefs

Programs

Formula

From Paul Barry, May 27 2003: (Start)
Binomial transform is A045891. Partial sums are A008805. The sequence 0, 1, 0, 2, ... has a(n)=floor((n+2)/2)(1-(-1)^n)/2.
a(n) = floor((n+3)/2) * (1+(-1)^n)/2. (End)
a(n) = (n+2)(n+3)/2 mod n+2. - Amarnath Murthy, Jun 17 2004
a(n) = (n+2)*(1 + (-1)^n)/4. - Bruno Berselli, Apr 01 2011
a(n) = A008619(n) * A059841(n). - Wesley Ivan Hurt, Jun 17 2013
E.g.f.: cosh(x) + x*sinh(x)/2. - Stefano Spezia, Mar 26 2022

A003817 a(0) = 0, a(n) = a(n-1) OR n.

Original entry on oeis.org

0, 1, 3, 3, 7, 7, 7, 7, 15, 15, 15, 15, 15, 15, 15, 15, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63
Offset: 0

Views

Author

Keywords

Comments

Also, 0+1+2+...+n in lunar arithmetic in base 2 written in base 10. - N. J. A. Sloane, Oct 02 2010
For n>0: replace all 0's with 1's in binary representation of n. - Reinhard Zumkeller, Jul 14 2003

Crossrefs

This is Guy Steele's sequence GS(6, 6) (see A135416).
Cf. A167832, A167878. - Reinhard Zumkeller, Nov 14 2009
Cf. A179526; subsequence of A007448. - Reinhard Zumkeller, Jul 18 2010
Cf. A265705.

Programs

  • Haskell
    import Data.Bits ((.|.))
    a003817 n = if n == 0 then 0 else 2 * a053644 n - 1
    a003817_list = scanl (.|.) 0 [1..] :: [Integer]
    -- Reinhard Zumkeller, Dec 08 2012, Jan 15 2012
    
  • Maple
    A003817 := n -> n + Bits:-Nand(n, n):
    seq(A003817(n), n=0..61); # Peter Luschny, Sep 23 2019
  • Mathematica
    a[0] = 0; a[n_] := a[n] = BitOr[ a[n-1], n]; Table[a[n], {n, 0, 61}] (* Jean-François Alcover, Dec 19 2011 *)
    nxt[{n_,a_}]:={n+1,BitOr[a,n+1]}; Transpose[NestList[nxt,{0,0},70]] [[2]] (* Harvey P. Dale, May 06 2016 *)
    2^BitLength[Range[0,100]]-1 (* Paolo Xausa, Feb 08 2024 *)
  • PARI
    a(n)=1<<(log(2*n+1)\log(2))-1 \\ Charles R Greathouse IV, Dec 08 2011
    
  • Python
    def a(n): return 0 if n==0 else 1 + 2*a(int(n/2)) # Indranil Ghosh, Apr 28 2017
    
  • Python
    def A003817(n): return (1<Chai Wah Wu, Jul 17 2024

Formula

a(n) = a(n-1) + n*(1-floor(a(n-1)/n)). If 2^(k-1) <= n < 2^k, a(n) = 2^k - 1. - Benoit Cloitre, Aug 25 2002
a(n) = 1 + 2*a(floor(n/2)) for n > 0. - Benoit Cloitre, Apr 04 2003
G.f.: (1/(1-x)) * Sum_{k>=0} 2^k*x^2^k. - Ralf Stephan, Apr 18 2003
a(n) = 2*A053644(n)-1 = A092323(n) + A053644(n). - Reinhard Zumkeller, Feb 15 2004; corrected by Anthony Browne, Jun 26 2016
a(n) = OR{k OR (n-k): 0<=k<=n}. - Reinhard Zumkeller, Jul 15 2008
For n>0: a(n+1) = A035327(n) + n = A035327(n) XOR n. - Reinhard Zumkeller, Nov 14 2009
A092323(n+1) = floor(a(n)/2). - Reinhard Zumkeller, Jul 18 2010
a(n) = A265705(n,0) = A265705(n,n). - Reinhard Zumkeller, Dec 15 2015
a(n) = A062383(n) - 1.
G.f. A(x) satisfies: A(x) = 2*A(x^2)*(1 + x) + x/(1 - x). - Ilya Gutkovskiy, Aug 31 2019
a(n) >= A175039(n) - Austin Shapiro, Dec 29 2022

A162610 Triangle read by rows in which row n lists n terms, starting with 2n-1, with gaps = n-1 between successive terms.

Original entry on oeis.org

1, 3, 4, 5, 7, 9, 7, 10, 13, 16, 9, 13, 17, 21, 25, 11, 16, 21, 26, 31, 36, 13, 19, 25, 31, 37, 43, 49, 15, 22, 29, 36, 43, 50, 57, 64, 17, 25, 33, 41, 49, 57, 65, 73, 81, 19, 28, 37, 46, 55, 64, 73, 82, 91, 100, 21, 31, 41, 51, 61, 71, 81, 91, 101, 111, 121
Offset: 1

Views

Author

Omar E. Pol, Jul 09 2009

Keywords

Comments

Note that the last term of the n-th row is the n-th square A000290(n).
Row sums are n*(n^2+2*n-1)/2, apparently in A127736. - R. J. Mathar, Jul 20 2009

Examples

			Triangle begins:
1
3, 4
5, 7, 9
7, 10, 13, 16
9, 13, 17, 21, 25
11, 16, 21, 26, 31, 36
		

Crossrefs

Cf. A209297; A005408 (left edge), A000290 (right edge), A127736 (row sums), A056220 (central terms), A026741 (number of odd terms per row), A142150 (number of even terms per row), A221491 (number of primes per row).

Programs

  • Haskell
    a162610 n k = k * n - k + n
    a162610_row n = map (a162610 n) [1..n]
    a162610_tabl = map a162610_row [1..]
    -- Reinhard Zumkeller, Jan 19 2013
  • Mathematica
    Flatten[Table[NestList[#+n-1&,2n-1,n-1], {n,15}]] (* Harvey P. Dale, Oct 20 2011 *)
  • Python
    # From R. J. Mathar, Oct 20 2009
    def A162610(n, k):
        return 2*n-1+(k-1)*(n-1)
    print([A162610(n,k) for n in range(1,20) for k in range(1,n+1)])
    

Formula

T(n,k) = n+k*n-k, 1<=k<=n. - R. J. Mathar, Oct 20 2009
T(n,k) = (k+1)*(n-1)+1. - Reinhard Zumkeller, Jan 19 2013

Extensions

More terms from R. J. Mathar, Oct 20 2009

A257850 a(n) = floor(n/10) * (n mod 10).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 0, 8
Offset: 0

Views

Author

M. F. Hasler, May 10 2015

Keywords

Comments

Equivalently, write n in base 10, multiply the last digit by the number with its last digit removed.
See A142150(n-1) for the base 2 analog and A257843 - A257849 for the base 3 - base 9 variants.
The first 100 terms coincide with those of A035930 (maximal product of any two numbers whose concatenation is n), A171765 (product of digits of n, or 0 for n<10), A257297 ((initial digit of n)*(n with initial digit removed)), but the sequence is of course different from each of these three.
The terms a(10) - a(100) also coincide with those of A007954 (product of decimal digits of n).

Crossrefs

Cf. A142150 (the base 2 analog), A115273, A257844 - A257849.

Programs

  • Magma
    [Floor(n/10)*(n mod 10): n in [0..100]]; // Vincenzo Librandi, May 11 2015
    
  • Mathematica
    Table[Floor[n/10] Mod[n, 10], {n, 100}] (* Vincenzo Librandi, May 11 2015 *)
  • PARI
    a(n,b=10)=(n=divrem(n,b))[1]*n[2]
    
  • Python
    def A257850(n): return n//10*(n%10) # M. F. Hasler, Sep 01 2021

Formula

a(n) = 2*a(n-10)-a(n-20). - Colin Barker, May 11 2015
G.f.: x^11*(9*x^8+8*x^7+7*x^6+6*x^5+5*x^4+4*x^3+3*x^2+2*x+1) / ((x-1)^2*(x+1)^2*(x^4-x^3+x^2-x+1)^2*(x^4+x^3+x^2+x+1)^2). - Colin Barker, May 11 2015
Showing 1-10 of 48 results. Next