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

A006116 Sum of Gaussian binomial coefficients [n,k] for q=2 and k=0..n.

Original entry on oeis.org

1, 2, 5, 16, 67, 374, 2825, 29212, 417199, 8283458, 229755605, 8933488744, 488176700923, 37558989808526, 4073773336877345, 623476476706836148, 134732283882873635911, 41128995468748254231002, 17741753171749626840952685, 10817161765507572862559462656
Offset: 0

Views

Author

Keywords

Comments

Also number of distinct binary linear codes of length n and any dimension.
Equivalently, number of subgroups of the Abelian group (C_2)^n.
Let V_n be an n-dimensional vector space over a field with 2 elements. Let P(V_n) be the collection of all subspaces of V_n. Then a(n-1) is the number of times any given nonzero vector of V_n appears in P(V_n). - Geoffrey Critzer, Jun 05 2017
With V_n and P(V_n) as above, a(n) is also the cardinality of P(V_n). - Vaia Patta, Jun 25 2019

Examples

			O.g.f.: A(x) = 1/(1-x) + x/((1-x)*(1-2x)) + x^2/((1-x)*(1-2x)*(1-4x)) + x^3/((1-x)*(1-2x)*(1-4x)*(1-8x)) + ...
Also generated by iterated binomial transforms in the following way:
[1,2,5,16,67,374,2825,29212,...] = BINOMIAL([1,1,2,6,26,158,1330,...]); see A135922;
[1,2,6,26,158,1330,15414,245578,...] = BINOMIAL([1,1,3,13,83,749,...]);
[1,3,13,83,749,9363,160877,...] = BINOMIAL^2([1,1,5,33,317,4361,...]);
[1,5,33,317,4361,82789,2148561,...] = BINOMIAL^4([1,1,9,97,1433,...]);
[1,9,97,1433,30545,902601,...] = BINOMIAL^8([1,1,17,321,7601,252833,...]);
etc.
		

References

  • J. Goldman and G.-C. Rota, The number of subspaces of a vector space, pp. 75-83 of W. T. Tutte, editor, Recent Progress in Combinatorics. Academic Press, NY, 1969.
  • I. P. Goulden and D. M. Jackson, Combinatorial Enumeration. Wiley, NY, 1983, p. 99.
  • F. J. MacWilliams and N. J. A. Sloane, The Theory of Error-Correcting Codes, Elsevier-North Holland, 1978, p. 698.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • M. Sved, Gaussians and binomials, Ars. Combinatoria, 17A (1984), 325-351.

Crossrefs

Cf. A006516. Row sums of A022166.
Cf. A005329, A083906. - Paul D. Hanna, Nov 29 2008

Programs

  • Magma
    I:=[1,2]; [n le 2 select I[n] else 2*Self(n-1)+(2^(n-2)-1)*Self(n-2): n in [1..20]]; // Vincenzo Librandi, Aug 12 2014
  • Maple
    gf:= m-> add(x^n/mul(1-2^k*x, k=0..n), n=0..m):
    a:= n-> coeff(series(gf(n), x, n+1), x, n):
    seq(a(n), n=0..20);  # Alois P. Heinz, Apr 24 2012
    # second Maple program:
    b:= proc(n, m) option remember; `if`(n=0, 1,
          2^m*b(n-1, m)+b(n-1, m+1))
        end:
    a:= n-> b(n, 0):
    seq(a(n), n=0..25);  # Alois P. Heinz, Aug 08 2021
  • Mathematica
    faq[n_, q_] = Product[(1-q^(1+k))/(1-q), {k, 0, n-1}]; qbin[n_, m_, q_] = faq[n, q]/(faq[m, q]*faq[n-m, q]); a[n_] := Sum[qbin[n, k, 2], {k, 0, n}]; a /@ Range[0, 19] (* Jean-François Alcover, Jul 21 2011 *)
    Flatten[{1, RecurrenceTable[{a[n]==2*a[n-1]+(2^(n-1)-1)*a[n-2], a[0]==1, a[1]==2}, a, {n,1,15}]}] (* Vaclav Kotesovec, Aug 21 2013 *)
    QP = QPochhammer; a[n_] := Sum[QP[2, 2, n]/(QP[2, 2, k]*QP[2, 2, n-k]), {k, 0, n}]; Table[a[n], {n, 0, 20}] (* Jean-François Alcover, Nov 23 2015 *)
    Table[Sum[QBinomial[n, k, 2], {k, 0, n}], {n, 0, 19}] (* Ivan Neretin, Mar 28 2016 *)
  • PARI
    a(n)=polcoeff(sum(k=0, n, x^k/prod(j=0, k, 1-2^j*x+x*O(x^n))), n) \\ Paul D. Hanna, Dec 06 2007
    
  • PARI
    a(n,q=2)=sum(k=0,n,prod(i=1,n-k,(q^(i+k)-1)/(q^i-1))) \\ Paul D. Hanna, Nov 29 2008
    

Formula

O.g.f.: A(x) = Sum_{n>=0} x^n / Product_{k=0..n} (1 - 2^k*x). - Paul D. Hanna, Dec 06 2007
From Paul D. Hanna, Nov 29 2008: (Start)
Coefficients of the square of the q-exponential of x evaluated at q=2, where the q-exponential of x = Sum_{n>=0} x^n/F(n) and F(n) = Product{i=1..n} (q^i-1)/(q-1) is the q-factorial of n.
G.f.: (Sum_{k=0..n} x^n/F(n))^2 = Sum_{k=0..n} a(n)*x^n/F(n) where F(n) = A005329(n) = Product{i=1..n} (2^i - 1).
a(n) = Sum_{k=0..n} F(n)/(F(k)*F(n-k)) where F(n)=A005329(n) is the 2-factorial of n.
a(n) = Sum_{k=0..n} Product_{i=1..n-k} (2^(i+k) - 1)/(2^i - 1).
a(n) = Sum_{k=0..A033638(n)} A083906(n,k)*2^k. (End)
G.f.: 1 + x*(G(0) - 1)/(x-1) where G(k) = 1 - 1/(1-2^k*x)/(1-x/(x-1/G(k+1) )); (recursively defined continued fraction). - Sergei N. Gladkovskii, Jan 16 2013
a(n) = 2*a(n-1) + (2^(n-1)-1)*a(n-2). [Hitzemann and Hochstattler]. - R. J. Mathar, Aug 21 2013
a(n) ~ c * 2^(n^2/4), where c = EllipticTheta[3,0,1/2] / QPochhammer[1/2,1/2] = 7.3719688014613... if n is even and c = EllipticTheta[2,0,1/2] / QPochhammer[1/2,1/2] = 7.3719494907662... if n is odd. - Vaclav Kotesovec, Aug 21 2013

A296030 Pairs of coordinates for successive integers in the square spiral (counterclockwise).

Original entry on oeis.org

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

Views

Author

Benjamin Mintz, Dec 03 2017

Keywords

Comments

The spiral is also called the Ulam spiral, cf. A174344, A274923 (x and y coordinates). - M. F. Hasler, Oct 20 2019
The n-th positive integer occupies the point whose x- and y-coordinates are represented in the sequence by a(2n-1) and a(2n), respectively. - Robert G. Wilson v, Dec 03 2017
From Robert G. Wilson v, Dec 05 2017: (Start)
The cover of the March 1964 issue of Scientific American (see link) depicts the Ulam Spiral with a heavy black line separating the numbers from their non-sequential neighbors. The pairs of coordinates for the points on this line, assuming it starts at the origin, form this sequence, negated.
The first number which has an abscissa value of k beginning at 0: 1, 2, 10, 26, 50, 82, 122, 170, 226, 290, 362, 442, 530, 626, 730, 842, 962, ...; g.f.: -(x^3 +7x^2 -x +1)/(x-1)^3;
The first number which has an abscissa value of -k beginning at 0: 1, 5, 17, 37, 65, 101, 145, 197, 257, 325, 401, 485, 577, 677, 785, 901, ...; g.f.: -(5x^2 +2x +1)/(x-1)^3;
The first number which has an ordinate value of k beginning at 0: 1, 3, 13, 31, 57, 91, 133, 183, 241, 307, 381, 463, 553, 651, 757, 871, 993, ...; g.f.: -(7x^2+1)/(x-1)^3;
The first number which has an ordinate value of -k beginning at 0: 1, 7, 21, 43, 73, 111, 157, 211, 273, 343, 421, 507, 601, 703, 813, 931, ...; g.f.: -(3x^2+4x+1)/(x-1)^3;
The union of the four sequences above is A033638.
(End)
Sequences A174344, A268038 and A274923 start with the integer 0 at the origin (0,0). One might then prefer offset 0 as to have (a(2n), a(2n+1)) as coordinates of the integer n. - M. F. Hasler, Oct 20 2019
This sequence can be read as an infinite table with 2 columns, where row n gives the x- and y-coordinate of the n-th point on the spiral. If the point at the origin has number 0, then the points with coordinates (n,n), (-n,n), (n,-n) and (n,-n) have numbers given by A002939(n) = 2n(2n-1): (0, 2, 12, 30, ...), A016742(n) = 4n^2: (0, 4, 16, 36, ...), A002943(n) = 2n(2n+1): (0, 6, 20, 42, ...) and A033996(n) = 4n(n+1): (0, 8, 24, 48, ...), respectively. - M. F. Hasler, Nov 02 2019

Examples

			The integer 1 occupies the initial position, so its coordinates are {0,0}; therefore a(1)=0 and a(2)=0.
The integer 2 occupies the position immediately to the right of 1, so its coordinates are {1,0}.
The integer 3 occupies the position immediately above 2, so its coordinates are {1,1}; etc.
		

References

  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 935.

Crossrefs

Cf. Diagonal rays (+-n,+-n): A002939 (2n(2n-1): 0, 2, 12, 30, ...: NE), A016742 (4n^2: 0, 4, 16, 36, ...: NW), A002943 (2n(2n+1): 0, 6, 20, 42, ...: SW) and A033996 (4n(n+1): 0, 8, 24, 48, ...: SE).

Programs

  • Mathematica
    f[n_] := Block[{k = Ceiling[(Sqrt[n] - 1)/2], m, t}, t = 2k +1; m = t^2; t--; If[n >= m - t, {k -(m - n), -k}, m -= t; If[n >= m - t, {-k, -k +(m - n)}, m -= t; If[n >= m - t, {-k +(m - n), k}, {k, k -(m - n - t)}]]]]; Array[f, 40] // Flatten (* Robert G. Wilson v, Dec 04 2017 *)
    f[n_] := Block[{k = Mod[ Floor[ Sqrt[4 If[OddQ@ n, (n + 1)/2 - 2, (n/2 - 2)] + 1]], 4]}, f[n - 2] + If[OddQ@ n, Sin[k*Pi/2], -Cos[k*Pi/2]]]; f[1] = f[2] = 0; Array[f, 90] (* Robert G. Wilson v, Dec 14 2017 *)
    f[n_] := With[{t = Round@ Sqrt@ n}, 1/2*(-1)^t*({1, -1}(Abs[t^2 - n] - t) + t^2 - n - Mod[t, 2])]; Table[f@ n, {n, 0, 95}] // Flatten (* Mikk Heidemaa May 23 2020, after Stephen Wolfram *)
  • PARI
    apply( {coords(n)=my(m=sqrtint(n), k=m\/2); if(m <= n -= 4*k^2, [n-3*k,-k], n >= 0, [-k,k-n], n >= -m, [-k-n,k], [k,3*k+n])}, [0..99]) \\ Use concat(%) to remove brackets '[', ']'. This function gives the coordinates of n on the spiral starting with 0 at (0,0), as shown in Examples for A174344, A274923, ..., so (a(2n-1),a(2n)) = coords(n-1). To start with 1 at (0,0), change n to n-=1 in sqrtint(). The inverse function is pos(x,y) given e.g. in A316328. - M. F. Hasler, Oct 20 2019
  • Python
    from math import ceil, sqrt
    def get_coordinate(n):
        k=ceil((sqrt(n)-1)/2)
        t=2*k+1
        m=t**2
        t=t-1
        if n >= m - t:
            return k - (m-n), -k
        else:
            m -= t
        if n >= m - t:
            return -k, -k+(m-n)
        else:
            m -= t
        if n >= m-t:
            return -k+(m-n), k
        else:
            return k, k-(m-n-t)
    

Formula

a(2*n-1) = A174344(n).
a(2*n) = A274923(n) = -A268038(n).
abs(a(n+2) - a(n)) < 2.
a(2*n-1)+a(2*n) = A180714(n).
f(n) = floor(-n/4)*ceiling(-3*n/4 - 1/4) mod 2 + ceiling(n/8) (gives the pairs of coordinates for integers in the diagonal rays). - Mikk Heidemaa, May 07 2020

A080037 a(0)=2; for n > 0, a(n) = n + floor(sqrt(4n-3)) + 2.

Original entry on oeis.org

2, 4, 6, 8, 9, 11, 12, 14, 15, 16, 18, 19, 20, 22, 23, 24, 25, 27, 28, 29, 30, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 56, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 87, 88, 89, 90, 92
Offset: 0

Views

Author

N. J. A. Sloane, Mar 14 2003

Keywords

Comments

a(0)=2, a(1)=4; for n > 2, a(n) = a(n-1) + 1 if n is already in the sequence, a(n) = a(n-1) + 2 otherwise. [corrected by Jon E. Schoenfield, Jun 24 2018]
For n > 0, a(n) = ceiling((1 + sqrt(n))^2). Empirical observation. - Ronald S. Tiberio, Jun 24 2018
For n > 0, a(n) is the minimal number of thumbtacks needed to secure n square sheets of paper on a bulletin board - one thumbtack in each corner of each sheet - slight overlap allowed so that one thumbtack can secure up to four sheets. - Ronald S. Tiberio, Jun 24 2018
From Ya-Ping Lu, Mar 17 2022: (Start)
Integers m such that connecting the external lattice points of a square spiral with m lattice points forms a polyomino (m is indicated by * in the figure below).
.
37--36*-35*-34*-33*-32*-31
| |
38* 17--16*-15*-14*-13 30*
| | | |
39* 18* 5---4*--3 12* 29*
| | | | | |
40* 19* 6* 1---2* 11* 28*
| | | | |
41* 20* 7---8*--9*-10 27*
| | |
42* 21--22*-23*-24*-25*-26
|
43--44*-45*-46*-47*-48*-49* (End)

Crossrefs

Cf. A000267, A080036, A033638 (complement, except 2).

Programs

  • Maple
    f:= n -> n + floor(sqrt(4*n-3)) + 2:
    f(0):= 2:
    map(f, [$0..100]); # Robert Israel, Jul 27 2023
  • Mathematica
    Join[{2},Table[n+Floor[Sqrt[4n-3]]+2,{n,100}]] (* Harvey P. Dale, Jul 22 2025 *)
  • Python
    from math import isqrt
    def A080037(n): return n+2+isqrt((n<<2)-1) if n else 2 # Chai Wah Wu, Jul 27 2022

Formula

G.f.: (2-z)/(1-z)^2 + Sum_{k >= 1} z^(k^2+1)/(1-z) + Sum_{k >= 0} z^(k^2+k+1)/(1-z) = 1/2 + 1/(z-1)^2 - 1/(2*(z-1)) + z^(3/4)*JacobiTheta2(0,z)/(2*(1-z)) + z*JacobiTheta3(0,z)/(2*(1-z)). - Robert Israel, Jul 27 2023

A122197 Fractal sequence: count up to successive integers twice.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Fractal - deleting the first occurrence of each integer leaves the original sequence. Also, deleting all the 1's leaves the original sequence plus 1. New values occur at square indices. 1's occur at indices m^2+1 and m^2+m+1. Ordinal transform of A122196.
Except for its initial 1, A122197 is the natural fractal sequence of A002620; that is, A122197(n+1) is the number of the row of A194061 that contains n. See A194029 for definition of natural fractal sequence. - Clark Kimberling, Aug 12 2011
From Johannes W. Meijer, Sep 09 2013: (Start)
Triangle read by rows formed from antidiagonals of triangle A002260.
The row sums equal A008805(n-1) and the antidiagonal sums equal A211534(n+5). (End)

Examples

			The first few rows of the sequence a(n) as a triangle T(n, k):
  n/k  1   2   3
  1    1
  2    1
  3    1,  2
  4    1,  2
  5    1,  2,  3
  6    1,  2,  3
		

Crossrefs

Programs

  • Haskell
    import Data.List (transpose, genericIndex)
    a122197 n k = genericIndex (a122197_row n) (k - 1)
    a122197_row n = genericIndex a122197_tabf (n - 1)
    a122197_tabf = concat $ transpose [a002260_tabl, a002260_tabl]
    a122197_list = concat a122197_tabf
    -- Reinhard Zumkeller, Aug 07 2015, Jul 19 2012
    
  • Maple
    From Johannes W. Meijer, Sep 09 2013: (Start)
    a := proc(n) local t: t := floor((sqrt(4*n-3)-1)/2): (n-1) mod (t+1) + 1 end: seq(a(n), n=1..105); # End first program
    T := proc(n, k): if n < 1 then return(0) elif k < 1 or k> floor((n+1)/2) then return(0) else k fi: end: seq(seq(T(n, k), k=1..floor((n+1)/2)), n=1..19); # End second program. (End)
  • Mathematica
    With[{c=Table[Range[n],{n,10}]},Flatten[Riffle[c,c]]] (* Harvey P. Dale, Apr 19 2013 *)
  • PARI
    a(n)=n - (sqrtint(4*n) + 1)\2*sqrtint(n-1) \\ Charles R Greathouse IV, Jun 08 2020
    
  • Python
    from math import isqrt
    def A122197(n): return 1 if n<=1 else 1+((n-1)%((m:=isqrt(n-1))+int(n-1>m*(m+1)))) # Chai Wah Wu, Jun 05 2025

Formula

From Boris Putievskiy, Sep 09 2013: (Start)
a(n) = (A001477(n-1) mod A000194(n-1)) + 1 for n >= 2 with a(1) = 1.
a(n) = ((n-1) mod (t+1)) + 1, where t = floor((sqrt(4*n-3)-1)/2). (End)
From Johannes W. Meijer, Sep 09 2013: (Start)
T(n, k) = k for n >= 1 and 1 <= k <= (n+1)/2; T(n, k) = 0 elsewhere.
T(n, k) = A002260(n-k, k). (End)
a(n) = n - floor(sqrt(n) + 1/2)*floor(sqrt(n-1)). - Ridouane Oudra, Jun 08 2020
a(n) = A339399(2n-1). - Wesley Ivan Hurt, Jan 09 2022

A083906 Table read by rows: T(n, k) is the number of length n binary words with exactly k inversions.

Original entry on oeis.org

1, 2, 3, 1, 4, 2, 2, 5, 3, 4, 3, 1, 6, 4, 6, 6, 6, 2, 2, 7, 5, 8, 9, 11, 9, 7, 4, 3, 1, 8, 6, 10, 12, 16, 16, 18, 12, 12, 8, 6, 2, 2, 9, 7, 12, 15, 21, 23, 29, 27, 26, 23, 21, 15, 13, 7, 4, 3, 1, 10, 8, 14, 18, 26, 30, 40, 42, 48, 44, 46, 40, 40, 30, 26, 18, 14, 8, 6, 2, 2
Offset: 0

Views

Author

Alford Arnold, Jun 19 2003

Keywords

Comments

There are A033638(n) values in the n-th row, compliant with the order of the polynomial.
In the example for n=6 detailed below, the orders of [6, k]_q are 1, 6, 9, 10, 9, 6, 1 for k = 0..6,
the maximum order 10 defining the row length.
Note that 1 6 9 10 9 6 1 and related distributions are antidiagonals of A077028.
A083480 is a variation illustrating a relationship with numeric partitions, A000041.
The rows are formed by the nonzero entries of the columns of A049597.
If n is even the n-th row converges to n+1, n-1, n-4, ..., 19, 13, 7, 4, 3, 1 which is A029552 reversed, and if n is odd the sequence is twice A098613. - Michael Somos, Jun 25 2017

Examples

			When viewed as an array with A033638(r) entries per row, the table begins:
. 1 ............... : 1
. 2 ............... : 2
. 3 1 ............. : 3 + q = (1) + (1+q) + (1)
. 4 2 2 ........... : 4 + 2q + 2q^2 = 1 + (1+q+q^2) + (1+q+q^2) + 1
. 5 3 4 3 1 ....... : 5 + 3q + 4q^2 + 3q^3 + q^4
. 6 4 6 6 6 2 2
. 7 5 8 9 11 9 7 4 3 1
. 8 6 10 12 16 16 18 12 12 8 6 2 2
. 9 7 12 15 21 23 29 27 26 23 21 15 13 7 4 3 1
...
The second but last row is from the sum over 7 q-polynomials coefficients:
. 1 ....... : 1 = [6,0]_q
. 1 1 1 1 1 1 ....... : 1+q+q^2+q^3+q^4+q^5 = [6,1]_q
. 1 1 2 2 3 2 2 1 1 ....... : 1+q+2q^2+2q^3+3q^4+2q^5+2q^6+q^7+q^8 = [6,2]_q
. 1 1 2 3 3 3 3 2 1 1 ....... : 1+q+2q^2+3q^3+3q^4+3q^5+3q^6+2q^7+q^8+q^9 = [6,3]_q
. 1 1 2 2 3 2 2 1 1 ....... : 1+q+2q^2+2q^3+3q^4+2q^5+2q^6+q^7+q^8 = [6,4]_q
. 1 1 1 1 1 1 ....... : 1+q+q^2+q^3+q^4+q^5 = [6,5]_q
. 1 ....... : 1 = [6,6]_q
		

References

  • George E. Andrews, 'Theory of Partitions', 1976, page 242.

Crossrefs

Programs

  • Magma
    R:=PowerSeriesRing(Rationals(), 100);
    qBinom:= func< n,k,x | n eq 0 or k eq 0 select 1 else (&*[(1-x^(n-j))/(1-x^(j+1)): j in [0..k-1]]) >;
    A083906:= func< n,k | Coefficient(R!((&+[qBinom(n,k,x): k in [0..n]]) ), k) >;
    [A083906(n,k): k in [0..Floor(n^2/4)], n in [0..12]]; // G. C. Greubel, Feb 13 2024
    
  • Maple
    QBinomial := proc(n,m,q) local i ; factor( mul((1-q^(n-i))/(1-q^(i+1)),i=0..m-1) ) ; expand(%) ; end:
    A083906 := proc(n,k) add( QBinomial(n,m,q),m=0..n ) ; coeftayl(%,q=0,k) ; end:
    for n from 0 to 10 do for k from 0 to A033638(n)-1 do printf("%d,",A083906(n,k)) ; od: od: # R. J. Mathar, May 28 2009
    T := proc(n, k) if n < 0 or k < 0 or k > floor(n^2/4) then return 0 fi;
    if n < 2 then return n + 1 fi; 2*T(n-1, k) - T(n-2, k) + T(n-2, k - n + 1) end:
    seq(print(seq(T(n, k), k = 0..floor((n/2)^2))), n = 0..8);  # Peter Luschny, Feb 16 2024
  • Mathematica
    Table[CoefficientList[Total[Table[FunctionExpand[QBinomial[n, k, q]], {k, 0, n}]],q], {n, 0, 10}] // Grid (* Geoffrey Critzer, May 14 2017 *)
  • PARI
    {T(n, k) = polcoeff(sum(m=0, n, prod(k=0, m-1, (x^n - x^k) / (x^m - x^k))), k)}; /* Michael Somos, Jun 25 2017 */
    
  • SageMath
    def T(n,k): # T = A083906
        if k<0 or k> (n^2//4): return 0
        elif n<2 : return n+1
        else: return 2*T(n-1, k) - T(n-2, k) + T(n-2, k-n+1)
    flatten([[T(n,k) for k in range(int(n^2//4)+1)] for n in range(13)]) # G. C. Greubel, Feb 13 2024

Formula

T(n, k) is the coefficient [q^k] of the Sum_{m=0..n} [n, m]_q over q-Binomial coefficients.
Row sums: Sum_{k=0..floor(n^2/4)} T(n,k) = 2^n.
For n >= k, T(n+1,k) = T(n, k) + A000041(k). - Geoffrey Critzer, Feb 12 2021
Sum_{k=0..floor(n^2/4)} (-1)^k*T(n, k) = A060546(n). - G. C. Greubel, Feb 13 2024
From Mikhail Kurkov, Feb 14 2024: (Start)
T(n, k) = 2*T(n-1, k) - T(n-2, k) + T(n-2, k - n + 1) for n >= 2 and 0 <= k <= floor(n^2/4).
Sum_{i=0..n} T(n-i, i) = A000041(n+1). Note that upper limit of the summation can be reduced to A083479(n) = (n+2) - ceiling(sqrt(4*n)).
Both results were proved (see MathOverflow link for details). (End)
From G. C. Greubel, Feb 17 2024: (Start)
T(n, floor(n^2/4)) = A000034(n).
Sum_{k=0..floor(n^2/4)} (-1)^k*T(n, k) = A016116(n+1).
Sum_{k=0..(n + 2) - ceiling(sqrt(4*n))} (-1)^k*T(n - k, k) = (-1)^n*A000025(n+1) = -A260460(n+1). (End)

Extensions

Edited by R. J. Mathar, May 28 2009
New name using a comment from Geoffrey Critzer by Peter Luschny, Feb 17 2024

A122196 Fractal sequence: count down by 2's from successive integers.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

First differences of A076644. Fractal - deleting the first occurrence of each integer leaves the original sequence. Also, original sequence plus 1. 1's occur at square indices. New values occur at indices m^2+1 and m^2+m+1.
Ordinal transform of A122197.
Row sums give A002620. - Gary W. Adamson, Nov 29 2008
From Gary W. Adamson, Dec 05 2009: (Start)
A122196 considered as an infinite lower triangular matrix * [1,2,3,...] =
A006918 starting (1, 2, 5, 8, 14, 20, 30, 40, ...).
Let A122196 = an infinite lower triangular matrix M; then lim_{n->infinity} M^n = A171238, a left-shifted vector considered as a matrix. (End)
A122196 is the fractal sequence associated with the dispersion A082156; that is, A122196(n) is the number of the row of A082156 that contains n. - Clark Kimberling, Aug 12 2011
From Johannes W. Meijer, Sep 09 2013: (Start)
The alternating row sums lead to A004524(n+2).
The antidiagonal sums equal A001840(n). (End)

Examples

			The first few rows of the sequence a(n) as a triangle T(n, k):
n/k  1   2   3
1    1
2    2
3    3,  1
4    4,  2
5    5,  3,  1
6    6,  4,  2
		

Crossrefs

Programs

  • Haskell
    a122196 n = a122196_list !! (n-1)
    a122196_list = concatMap (\x -> enumFromThenTo x (x - 2) 1) [1..]
    -- Reinhard Zumkeller, Jul 19 2012
  • Maple
    From Johannes W. Meijer, Sep 09 2013: (Start)
    a := proc(n) local t: t:=floor((sqrt(4*n-3)-1)/2): floor(sqrt(4*n-1))-2*((n-1) mod (t+1)) end: seq(a(n), n=1..92); # End first program.
    T := (n, k) -> n-2*k+2: seq(seq(T(n, k), k=1..floor((n+1)/2)), n=1..18); # End second program. (End)
  • Mathematica
    Flatten@Range[Range[10], 1, -2] (* Birkas Gyorgy, Apr 07 2011 *)

Formula

From Boris Putievskiy, Sep 09 2013: (Start)
a(n) = 2*(1-A122197(n)) + A000267(n-1).
a(n) = floor(sqrt(4*n-1)) - 2*((n-1) mod (t+1)), where t = floor((sqrt(4*n-3)-1)/2). (End)
From Johannes W. Meijer, Sep 09 2013: (Start)
T(n, k) = n - 2*k + 2, for n >= 1 and 1 <= k <= floor((n+1)/2).
T(n, k) = A002260(n, n-2*k+2). (End)

A268192 Triangle read by rows: T(n,k) is the number of partitions of weight k among the complements of the partitions of n.

Original entry on oeis.org

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

Views

Author

Emeric Deutsch, Feb 12 2016

Keywords

Comments

The complement of a partition p[1] >= p[2] >=...>= p[k] is p[1]-p[2], p[1]-p[3], ..., p[1]-p[k]. Its Ferrers board emerges naturally from the Ferrers board of the given partition. The weight of a partition of n is n.
Sum of entries in row n is A000041(n) (the partition numbers).
Apparently, number of entries in row n is A033638(n-1) = 1 + floor((n-1)^2/4).
T(n,0) = A000005(n) = number of divisors of n.
T(n,1) = A070824(n+1).
Sum(k*T(n,k),k>0) = A188814(n).

Examples

			Row 4 is 3,0,2; indeed, the complements of [4], [3,1], [2,2], [2,1,1], [1,1,1,1] are: empty, [2], empty, [1,1], empty; their weights are 0, 2, 0, 2, 0, respectively.
From _Gus Wiseman_, Sep 24 2019: (Start)
Triangle begins:
  1
  2
  2 1
  3 0 2
  2 2 0 2 1
  4 0 2 1 2 0 2
  2 2 2 2 0 4 0 0 2 1
  4 1 2 0 6 0 2 2 1 0 2 0 2
  3 2 0 6 0 2 4 4 0 2 0 2 2 0 0 2 1
  4 0 6 0 2 4 5 0 6 0 4 2 0 0 4 1 0 0 2 0 2
  2 4 0 2 6 5 0 6 0 8 4 0 0 6 2 0 2 2 0 2 0 2 0 0 2 1
Row  n = 8 counts the following partitions:
  8          332   53      62       71        521     4211   611      5111
  44               22211   422      2111111   32111          311111   41111
  2222                     431
  11111111                 3221
                           3311
                           221111
(End)
		

Crossrefs

Programs

  • Maple
    q := 10: with(combinat): a := proc (i, j) options operator, arrow: partition(i)[j] end proc: P[q] := 0: for j to numbpart(q) do P[q] := sort(P[q]+t^(nops(a(q, j))*max(a(q, j))-q)) end do: P[q] := P[q];
    # second Maple program:
    b:= proc(n, i, l) option remember; expand(`if`(n=0 or i=1,
          x^(`if`(l=0, 0, n*(l-i))), b(n, i-1, l)+`if`(i>n, 0,
          x^(`if`(l=0, 0, l-i))*b(n-i, i, `if`(l=0, i, l)))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n$2, 0)):
    seq(T(n), n=1..15);  # Alois P. Heinz, Feb 12 2016
  • Mathematica
    b[n_, i_, l_] := b[n, i, l] = Expand[If[n == 0 || i == 1, x^(If[l == 0, 0, n*(l - i)]), b[n, i - 1, l] + If[i > n, 0, x^(If[l == 0, 0, l - i])*b[n - i, i, If[l == 0, i, l]]]]]; T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, n, 0]]; Table[T[n], {n, 1, 15}] // Flatten (* Jean-François Alcover, Dec 22 2016, after Alois P. Heinz *)
    Table[Length[Select[IntegerPartitions[n],Max[#]*Length[#]-n==k&]],{n,1,11},{k,0,Floor[(n-1)/2]*Ceiling[(n-1)/2]}] (* Gus Wiseman, Sep 24 2019 *)

Formula

The weight of the complement of a partition p is (number of parts of p)*(largest part of p) - weight of p.
For a given q, the Maple program yields the generating polynomial of row q.

A062869 Triangle read by rows: For n >= 0, k >= 0, T(n,k) is the number of permutations pi of n such that the total distance Sum_i abs(i-pi(i)) = 2k. Equivalently, k = Sum_i max(i-pi(i),0).

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 3, 1, 3, 7, 9, 4, 1, 4, 12, 24, 35, 24, 20, 1, 5, 18, 46, 93, 137, 148, 136, 100, 36, 1, 6, 25, 76, 187, 366, 591, 744, 884, 832, 716, 360, 252, 1, 7, 33, 115, 327, 765, 1523, 2553, 3696, 4852, 5708, 5892, 5452, 4212, 2844, 1764, 576, 1, 8, 42, 164, 524
Offset: 0

Views

Author

Olivier Gérard, Jun 26 2001

Keywords

Comments

Number of possible values is 1,2,3,5,7,10,13,17,21,... = A033638. Maximum distance divided by 2 is the same minus one, i.e., 0,1,2,4,6,9,12,16,20,... = A002620.
T. Kyle Petersen and Bridget Eileen Tenner proved that T(n,k) is also the number of permutations of n for which the sum of descent differences equals k. - Susanne Wienand, Sep 11 2014

Examples

			Triangle T(n,k) begins:
  1;
  1;
  1, 1;
  1, 2,  3;
  1, 3,  7,  9,   4;
  1, 4, 12, 24,  35,  24,  20;
  1, 5, 18, 46,  93, 137, 148, 136, 100,  36;
  1, 6, 25, 76, 187, 366, 591, 744, 884, 832, 716, 360, 252;
  ...
(4,3,1,2) has distances (3,1,2,2), sum is 8 and there are 3 other permutations of degree 4 with this sum.
		

References

  • D. E. Knuth, The Art of Computer Programming, vol. 3, (1998), page 22 (exercise 28) and page 597 (solution and comments).

Crossrefs

Row sums give A000142.
T(2n,n) gives A072948.
A357329 is a sub-triangle.

Programs

  • Maple
    # The following program yields the entries of the specified row n
    n := 9: with(combinat): P := permute(n): excsum := proc (p) (1/2)*add(abs(p[i]-i), i = 1 .. nops(p)) end proc: f[n] := sort(add(t^excsum(P[j]), j = 1 .. factorial(n))): seq(coeff(f[n], t, j), j = 0 .. floor((1/4)*n^2)); # Emeric Deutsch, Apr 02 2010
    # Maple program using the g.f. given by Guay-Paquey and Petersen:
    g:= proc(h, n) local i, j; j:= irem(h, 2, 'i');
           1-`if`(h=n, 0, (i+1)*z*t^(i+j)/g(h+1, n))
        end:
    T:= n-> (p-> seq(coeff(p, t, k), k=0..degree(p)))
            (coeff(series(1/g(0, n), z, n+1), z, n)):
    seq(T(n), n=0..10);  # Alois P. Heinz, May 02 2014
  • Mathematica
    g[h_, n_] := Module[{i, j}, {i, j} = QuotientRemainder[h, 2]; 1 - If[h == n, 0, (i + 1)*z*t^(i + j)/g[h + 1, n]]]; T[n_] := Function[p, Table[ Coefficient[p, t, k], {k, 0, Exponent[p, t]}]][SeriesCoefficient[ 1/g[0, n], {z, 0, n}]]; Table[T[n], {n, 1, 10}] // Flatten (* Jean-François Alcover, Jan 07 2016, after Alois P. Heinz *)
    f[i_] := If[i == 1, 1, -(i-1)^2 t^(2i - 3) z^2];
    g[i_] := 1 - (2i - 1) t^(i-1) z;
    cf = ContinuedFractionK[f[i], g[i], {i, 1, 5}];
    CoefficientList[#, t]& /@ CoefficientList[cf + O[z]^10, z] // Rest // Flatten (* Jean-François Alcover, Nov 25 2018, after Mathieu Guay-Paquet *)
  • Sage
    # The following Sage program
    # yields the entries of the first n rows
    # as a list of lists
    def get_first_rows(n):
        R, t = PolynomialRing(ZZ, 't').objgen()
        S, z = PowerSeriesRing(R, 'z').objgen()
        gf = S(1).add_bigoh(1)
        for i in srange(n, 0, -1):
            a = (i+1) // 2
            b = i // 2
            gf = 1 / (1 - a * t^b * z * gf)
        return [list(row) for row in gf.shift(-1)]
    # Mathieu Guay-Paquet, Apr 30 2014

Formula

From Mathieu Guay-Paquet, Apr 30 2014: (Start)
G.f.: 1/(1-z/(1-t*z/(1-2*t*z/(1-2*t^2*z/(1-3*t^2*z/(1-3*t^3*z/(1-4*t^3*z/(1-4*t^4*z/(...
This is a continued fraction where the (2i)th numerator is (i+1)*t^i*z, and the (2i+1)st numerator is (i+1)*t^(i+1)*z for i >= 0. The coefficient of z^n gives row n, n >= 1, and the coefficient of t^k gives column k, k >= 0. (End)
From Alois P. Heinz, Oct 02 2022: (Start)
Sum_{k=0..floor(n^2/4)} k * T(n,k) = A005990(n).
Sum_{k=0..floor(n^2/4)} (-1)^k * T(n,k) = A009006(n). (End).

Extensions

T(0,0)=1 prepended by Alois P. Heinz, Oct 03 2022

A260643 Start a spiral of numbers on a square grid, with the initial square as a(1) = 1. a(n) is the smallest positive integer not equal to or previously adjacent (horizontally/vertically) to its neighbors. See the Comments section for a more exact definition.

Original entry on oeis.org

1, 2, 3, 4, 2, 5, 3, 6, 7, 1, 8, 7, 4, 8, 5, 6, 4, 9, 7, 10, 1, 9, 8, 11, 3, 12, 11, 10, 12, 13, 1, 12, 14, 9, 10, 14, 1, 15, 6, 13, 2, 16, 3, 17, 11, 13, 5, 14, 2, 11, 6, 14, 13, 9, 15, 18, 2, 19, 5, 15, 16, 4, 17, 20, 2, 21, 3, 18, 16, 17, 5, 20, 4, 19, 6
Offset: 1

Views

Author

Peter Kagey, Nov 11 2015

Keywords

Comments

A more detailed definition from Antti Karttunen, Dec 09 2015: (Start)
After a(1) = 1, for the next term always choose the smallest number k >= 1 such that neither k and a(n-1) nor k and a(A265400(n)) [in case A265400(n) > 0] are equal, and neither of these pairs occur anywhere adjacent to each other (horizontally or vertically) in so far constructed spiral. Here A265400(n) gives the index of the nearest horizontally or vertically adjacent inner neighbor of the n-th term in spiral, or 0 if n is one of the corner cases A033638.
The condition "... do not occur anywhere adjacent to each other (horizontally or vertically) in so far constructed spiral" can be more formally stated as: there is no such 1 < j < n, for which either the unordered pair {a(j),a(j-1)} or [in case A265400(j) > 0] also the unordered pair {a(j),a(A265400(j))} would be equal to either of the unordered pair {k,a(n-1)} or the unordered pair {k,a(A265400(n))} [in case A265400(n) > 0], where k is the term chosen for a(n). (See also my reference Scheme-implementation.)
(End)

Examples

			a(8) = 6 because pairs {1,2}, {1,4} and {1,5} already occur, the immediately adjacent terms are 1 and 3, thus neither number can be used, so the smallest usable number is 6.
a(12) = 7 because 1 and 2 are already adjacent to 8; 2, 4, 5, and 6 are already adjacent to 3.
The following illustration is the timeline of spiral's construction step-by-step:
        |      |   3  |  43  | 243  | 243  |     |  243  |  243  |  2437
    1   |  12  |  12  |  12  |  12  | 512  |     |  512  |  5128 |  5128
        |      |      |      |      |      | ... |  3671 |  3671 |  3671
        |      |      |      |      |      |     |       |       |
  a(1)=1|a(2)=2|a(3)=3|a(4)=4|a(5)=2|a(6)=5|     |a(10)=1|a(11)=8|a(12)=7
Indices of this spiral are shown below using the base-36 system, employing as its placeholder values the digits 0-9 and letter A-Z. The 1 at the center is where the spiral starts:
            ZYXWV
           HGFEDU
           I543CT
           J612BS
           K789AR
           LMNOPQ
		

Crossrefs

Cf. A272573 (analogous sequence on a hexagonal tiling).
Cf. A265414 (positions of records, where n occurs for the first time), A265415 (positions of ones).

A334742 Pascal's spiral: starting with a(1) = 1, proceed in a square spiral, computing each term as the sum of horizontally and vertically adjacent prior terms.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 10, 12, 12, 14, 17, 20, 20, 23, 27, 32, 37, 37, 42, 48, 55, 62, 62, 69, 77, 87, 99, 111, 111, 123, 137, 154, 174, 194, 194, 214, 237, 264, 296, 333, 370, 370, 407, 449, 497, 552, 614, 676, 676, 738, 807, 884, 971, 1070
Offset: 1

Views

Author

Alec Jones and Peter Kagey, May 09 2020

Keywords

Comments

This is the square spiral analogy of Pascal's triangle thought of as a table read by antidiagonals.

Examples

			Spiral begins:
  111--99--87--77--69--62
                        |
   12--12--10---8---7  62
    |               |   |
   14   2---2---1   7  55
    |   |       |   |   |
   17   3   1---1   6  48
    |   |           |   |
   20   3---4---5---5  42
    |                   |
   20--23--27--32--37--37
a(15) = 10 = 8 + 2, the sum of the cells immediately to the right and below. The term to the left is not included in the sum because it has not yet occurred in the spiral.
		

Crossrefs

x- and y-coordinates are given by A174344 and A274923, respectively.

Formula

a(A033638(n)) = a(A002620(n)) for n > 1.
Previous Showing 11-20 of 58 results. Next