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.

A284877 Irregular triangle T(n,k) for 1 <= k <= n/2 + 1: T(n,k) = number of double palindrome structures of length n using exactly k different symbols.

This page as a plain text file.
%I A284877 #23 Apr 29 2021 12:32:45
%S A284877 1,1,1,1,3,1,7,2,1,15,5,1,25,21,3,1,49,42,7,1,79,122,44,4,1,129,225,
%T A284877 90,9,1,211,570,375,80,5,1,341,990,715,165,11,1,517,2321,2487,930,132,
%U A284877 6,1,819,3913,4550,1820,273,13,1,1275,8827,14350,8330,2009,203,7
%N A284877 Irregular triangle T(n,k) for 1 <= k <= n/2 + 1: T(n,k) = number of double palindrome structures of length n using exactly k different symbols.
%C A284877 A double palindrome is the concatenation of two palindromes. Permuting the symbols will not change the structure. For the purposed of this sequence, valid palindromes include both the empty word and a singleton symbol.
%H A284877 Andrew Howroyd, <a href="/A284877/b284877.txt">Table of n, a(n) for n = 1..960</a>
%F A284877 T(n, k) = (Sum_{j=0..k} (-1)^j * binomial(k, j) * A284873(n, k-j)) / k!.
%F A284877 T(n, k) = r(n, k) - Sum_{d|n, d<n} phi(n/d) * T(d,k) where r(2d, k) = d *(stirling2(d,k)+stirling2(d,k+1)), r(2d+1, k) = (2d+1)*stirling2(d+1,k).
%e A284877 Triangle starts:
%e A284877 1
%e A284877 1     1
%e A284877 1     3
%e A284877 1     7      2
%e A284877 1    15      5
%e A284877 1    25     21       3
%e A284877 1    49     42       7
%e A284877 1    79    122      44       4
%e A284877 1   129    225      90       9
%e A284877 1   211    570     375      80       5
%e A284877 1   341    990     715     165      11
%e A284877 1   517   2321    2487     930     132      6
%e A284877 1   819   3913    4550    1820     273     13
%e A284877 1  1275   8827   14350    8330    2009    203      7
%e A284877 1  1863  14480   25515   15750    3990    420     15
%e A284877 1  2959  31802   75724   64004   23296   3920    296     8
%e A284877 1  4335  51425  132090  118167   44982   7854    612    17
%e A284877 1  6703 110928  376779  445275  229257  57078   7074   414   9
%e A284877 1  9709 177270  647995  807975  433713 111720  14250   855  19
%e A284877 1 15067 377722 1798175 2892470 2023135 698670 126300 12000 560 10
%e A284877 ....
%e A284877 The first few structures are:
%e A284877 n = 1: a => 1
%e A284877 n = 2: aa; ab => 1 + 1
%e A284877 n = 3: aaa; aab, aba, abb => 1 + 3
%e A284877 n = 4: aaaa; aaab, aaba, aabb, abaa, abab, abba, abbb; abac, abcb => 1 + 7 + 2
%t A284877 r[d_, k_]:=If[OddQ[d], d*k^((d + 1)/2), (d/2)*(k + 1)*k^(d/2)]; a[n_, k_]:= r[n, k] - Sum[If[d<n, EulerPhi[n/d] a[d, k], 0], {d, Divisors[n]}]; T[n_, k_]:=(Sum[(-1)^j * Binomial[k, j] * a[n, k - j],{j, 0, k}]) / k!; Table[T[n, k], {n, 25}, {k, n/2 + 1}] // Flatten (* _Indranil Ghosh_, Apr 07 2017 *)
%o A284877 (PARI)
%o A284877 r(d,k)=if (d % 2 == 0, (d/2)*(stirling(d/2,k,2)+stirling(d/2+1,k,2)), d*stirling((d+1)/2, k,2));
%o A284877 a(n,k) = r(n,k) - sumdiv(n,d, if (d<n, eulerphi(n/d)*a(d,k), 0));
%o A284877 for(n=1, 15, for(k=1, n/2+1, print1( a(n,k),", ");); print(););
%o A284877 (Python)
%o A284877 from sympy import totient, divisors, binomial, factorial
%o A284877 def r(d, k): return (d//2)*(k + 1)*k**(d//2) if d%2 == 0 else d*k**((d + 1)//2)
%o A284877 def a(n, k): return r(n, k) - sum([totient(n//d)*a(d, k) for d in divisors(n) if d<n])
%o A284877 def T(n, k): return (sum([(-1)**j * binomial(k, j) * a(n, k - j) for j in range(k + 1)]))//factorial(k)
%o A284877 for n in range(1, 21): print([T(n, k) for k in range(1, n//2 + 2)]) # _Indranil Ghosh_, Apr 07 2017
%Y A284877 Columns k=2..4 are A328688, A328689, A328690.
%Y A284877 Row sums are A165137.
%Y A284877 Partial row sums include A180249, A328692, A328693.
%Y A284877 Cf. A284873, A284826.
%K A284877 nonn,tabf
%O A284877 1,5
%A A284877 _Andrew Howroyd_, Apr 04 2017