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

A097084 Triangle, read by rows, where the n-th diagonal equals the n-th row transformed by triangle A008459 (squared binomial coefficients).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 5, 1, 1, 4, 10, 10, 1, 1, 5, 18, 28, 17, 1, 1, 6, 27, 74, 69, 26, 1, 1, 7, 39, 137, 245, 151, 37, 1, 1, 8, 52, 236, 586, 676, 298, 50, 1, 1, 9, 68, 372, 1194, 2126, 1634, 540, 65, 1, 1, 10, 85, 552, 2322, 5152, 6620, 3578, 913, 82, 1, 1, 11, 105, 777, 3954, 12002, 19292, 18082, 7249, 1459, 101, 1
Offset: 0

Views

Author

Paul D. Hanna, Jul 23 2004

Keywords

Comments

Row sums form A097085.

Examples

			T(8,3) = 236 = (1)*1^2 + (5)*3^2 + (18)*3^2 + (28)*1^2
= Sum_{j=0..3} T(5,j)*C(3,j)^2.
Rows begin:
[1],
[1,1],
[1,2,1],
[1,3,5,1],
[1,4,10,10,1],
[1,5,18,28,17,1],
[1,6,27,74,69,26,1],
[1,7,39,137,245,151,37,1],
[1,8,52,236,586,676,298,50,1],...
		

Crossrefs

Programs

  • Maple
    T:= proc(n, k) option remember;
          `if`(n=k or k=0, 1, `if`(k<0 or k>n, 0,
           add(T(n-k, j)*binomial(k, j)^2, j=0..k)))
        end:
    seq(seq(T(n,k), k=0..n), n=0..12);  # Alois P. Heinz, Oct 30 2015
  • Mathematica
    T[, 0] = 1; T[n, n_] = 1; T[n_, k_] /; 0 < k < n := T[n, k] = Sum[T[n - k, j]*Binomial[k, j]^2, {j, 0, k}]; T[, ] = 0;
    Table[T[n, k], {n, 0, 12}, {k, 0, n}] // Flatten (* Jean-François Alcover, May 24 2016 *)
  • PARI
    T(n,k)=if(n
    				

Formula

T(n,k) = Sum_{j=0..k} T(n-k,j)*C(k,j)^2.

A263897 Number of anagram compositions of 2n that can be formed from the compositions of n.

Original entry on oeis.org

1, 1, 2, 6, 16, 44, 134, 414, 1290, 4102, 13306, 43718, 145176, 487384, 1651154, 5636702, 19381392, 67074420, 233483430, 817106622, 2873589060, 10151255976, 36009769278, 128231072994, 458268615966, 1643227382022, 5910606009330, 21322486928518, 77132729929864
Offset: 0

Views

Author

Gregory L. Simay, Oct 28 2015

Keywords

Comments

A composition of n is an ordered sequence of positive integers whose sum is n. An anagram composition of n can be divided into two consecutive subsequences having the same parts, with a central part between the subsequences permitted.
a(n) is the number of anagram compositions of 2n with no central summand.
Here is a computation algorithm: List the individual partitions of n. Then for each partition, determine the corresponding number of compositions. Square each of these numbers then add them together.

Examples

			For n=3, the compositions are [3], [1,2], [2,1], [1,1,1]. The anagram compositions of 2*3=6 are [3][3], [1,2][1,2], [1,2][2,1], [2,1][1,2], [2,1][2,1], [1,1,1][1,1,1], so there are a(3)=6 anagram compositions in all.
For n=4, the individual partitions are [4], [3,1], [2,2], [2,1,1] and [1,1,1,1]. The corresponding number of compositions are 1, 2, 1, 3, and 1. The corresponding squares of these numbers are 1, 4, 1, 9, and 1. The sum of these squares is a(4)=16.
		

Crossrefs

First differences of A097085.

Programs

  • Maple
    b:= proc(n, i, p) option remember; `if`(n=0, p!^2,
          `if`(i<1, 0, add(b(n-i*j, i-1, p+j)/j!^2, j=0..n/i)))
        end:
    a:= n-> b(n$2, 0):
    seq(a(n), n=0..35);  # Alois P. Heinz, Oct 29 2015
  • Mathematica
    b[n_, i_, p_] := b[n, i, p] = If[n == 0, p!^2, If[i<1, 0, Sum[b[n-i*j, i-1, p+j]/j!^2, {j, 0, n/i}]]]; a[n_] := b[n, n, 0]; Table[a[n], {n, 0, 35}] (* Jean-François Alcover, Nov 05 2015, after Alois P. Heinz *)
  • Python
    from sympy.core.cache import cacheit
    from sympy import factorial as f
    @cacheit
    def b(n, i, p): return f(p)**2 if n==0 else 0 if i<1 else sum(b(n - i*j, i - 1, p + j)//f(j)**2 for j in range(n//i + 1))
    def a(n): return b(n, n, 0)
    print([a(n) for n in range(36)]) # Indranil Ghosh, Aug 18 2017, after Maple code

Extensions

a(9)-a(28) from Alois P. Heinz, Oct 29 2015
Showing 1-2 of 2 results.