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

A357642 Number of even-length integer compositions of 2n whose half-alternating sum is 0.

Original entry on oeis.org

1, 0, 1, 4, 13, 48, 186, 712, 2717, 10432, 40222, 155384, 601426, 2332640, 9063380, 35269392, 137438685, 536257280, 2094786870, 8191506136, 32063203590, 125613386912, 492516592620, 1932569186288, 7588478653938, 29816630378368, 117226929901676, 461151757861552
Offset: 0

Views

Author

Gus Wiseman, Oct 12 2022

Keywords

Comments

We define the half-alternating sum of a sequence (A, B, C, D, E, F, G, ...) to be A + B - C - D + E + F - G - ...

Examples

			The a(0) = 1 through a(4) = 13 compositions:
  ()  .  (1111)  (1212)  (1313)
                 (1221)  (1322)
                 (2112)  (1331)
                 (2121)  (2213)
                         (2222)
                         (2231)
                         (3113)
                         (3122)
                         (3131)
                         (111311)
                         (112211)
                         (113111)
                         (11111111)
		

Crossrefs

The skew-alternating version appears to be A000984.
For original alternating sum we have A001700/A088218.
The version for partitions of any length is A357639, ranked by A357631.
For length multiple of 4 we have A110145.
These compositions of any length are ranked by A357625, reverse A357626.
A124754 gives alternating sum of standard compositions, reverse A344618.
A357621 = half-alternating sum of standard compositions, reverse A357622.
A357637 counts partitions by half-alternating sum, skew A357638.

Programs

  • Mathematica
    Table[Length[Select[Join @@ Permutations/@IntegerPartitions[2n],EvenQ[Length[#]]&&halfats[#]==0&]],{n,0,9}]
  • PARI
    a(n) = {my(v, res); if(n < 3, return(1 - bitand(n,1))); res = 0; v = vector(2*n, i, binomial(n-1,i-1)); forstep(i = 4, 2*n, 2, lp = i\4 * 2; rp = i - lp; res += v[lp] * v[rp]; ); res } \\ David A. Corneth, Oct 13 2022

Extensions

More terms from Alois P. Heinz, Oct 12 2022

A159916 Triangle T(m,n) = number of subsets of {1,...,m} with n elements having an odd sum, 1 <= n <= m.

Original entry on oeis.org

1, 1, 1, 2, 2, 0, 2, 4, 2, 0, 3, 6, 4, 2, 1, 3, 9, 10, 6, 3, 1, 4, 12, 16, 16, 12, 4, 0, 4, 16, 28, 32, 28, 16, 4, 0, 5, 20, 40, 60, 66, 44, 16, 4, 1, 5, 25, 60, 100, 126, 110, 60, 20, 5, 1, 6, 30, 80, 160, 236, 236, 160, 80, 30, 6, 0, 6, 36, 110, 240, 396, 472, 396, 240, 110, 36, 6, 0
Offset: 1

Views

Author

M. F. Hasler, Apr 30 2009

Keywords

Comments

One could extend the triangle to include values for m=0 and/or n=0, but these correspond to empty sets and would always be 0. The first odd value for odd m and 1

Examples

			The triangle starts:
(m=1) 1,
(m=2) 1,1,
(m=3) 2,2,0,
(m=4) 2,4,2,0,
(m=5) 3,6,4,2,1,
...
T(5,3)=4, since the set {1,2,3,4,5} has four 3-element subsets having an odd sum of elements, namely {1,2,4}, {1,3,5}, {2,3,4} and {2,4,5}.
		

Crossrefs

T(2n,n) gives A110145.

Programs

  • Maple
    b:= proc(n, s) option remember; expand(
          `if`(n=0, s, b(n-1, s)+x*b(n-1, irem(s+n, 2))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(b(n, 0)):
    seq(T(n), n=1..15);  # Alois P. Heinz, Feb 04 2017
  • Mathematica
    b[n_, s_] := b[n, s] = Expand[If[n==0, s, b[n-1, s] + x*b[n-1, Mod[s+n, 2]] ]];
    T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 1, n}]][b[n, 0]];
    Table[T[n], {n, 1, 15}] // Flatten (* Jean-François Alcover, Nov 17 2017, after Alois P. Heinz *)
  • PARI
    T(n,k)=sum( i=2^k-1,2^n-2^(n-k), norml2(binary(i))==k & sum(j=0,n\2, bittest(i,2*j))%2 )

Formula

T(m,m) = A133872(m-1), T(m,1) = A004526(m+1).
T(n,k) = A007318(n,k) - A282011(n,k). - Alois P. Heinz, Feb 06 2017

A277247 a(n) = Sum_{k=0..floor(n/2)} binomial(n, k)^2.

Original entry on oeis.org

1, 1, 5, 10, 53, 126, 662, 1716, 8885, 24310, 124130, 352716, 1778966, 5200300, 25947612, 77558760, 383358645, 1166803110, 5719519850, 17672631900, 85990654178, 269128937220, 1300866635172, 4116715363800, 19780031677718, 63205303218876, 302045506654052
Offset: 0

Author

Vladimir Reshetnikov, Oct 06 2016

Keywords

Comments

Interleaves A036910 and A002458.

Crossrefs

Programs

  • Maple
    A277247 := proc(n)
        add(binomial(n,k)^2,k=0..floor(n/2)) ;
    end proc:
    seq(A277247(n),n=0..50) ; # R. J. Mathar, Jan 11 2024
  • Mathematica
    Table[(Binomial[2 n, n] + (Binomial[n, n/2] Cos[Pi n/2])^2)/2, {n, 0, 30}]
    CoefficientList[Series[(1/Sqrt[1-4x]+(2EllipticK[16 x^2])/Pi)/2, {x, 0, 20}], x] (* Benedict W. J. Irwin, Oct 19 2016 *)

Formula

a(n) = (binomial(2*n, n) + (binomial(n, n/2)*cos(Pi*n/2))^2)/2.
D-finite with recurrence: 2*(2*n+1)*(4*n^2+15*n+13)*(16*(n+1)^2*a(n) - (n+2)^2*a(n+2)) = (n+2)*(4*n^2+7*n+2)*(16*(n+2)^2*a(n+1) - (n+3)^2*a(n+3)).
G.f.: (1/sqrt(1 - 4*x) + 2*K(4*x)/Pi)/2, where K is the complete elliptic integral of the first kind with modulus 4*x. - Benedict W. J. Irwin, Oct 19 2016
D-finite with recurrence n^2*(n-1)*a(n) -2*(3*n-4)*(n-1)^2*a(n-1) +4*(-19*n^2+64*n-56)*a(n-2) +16*(4*n^3-11*n^2-16*n+49)*a(n-3) -64*(4*n-15)*(n-3)^2*a(n-4) +256*(2*n-9)*(n-4)^2*a(n-5)=0. - R. J. Mathar, Jan 11 2024
Showing 1-3 of 3 results.