OFFSET
1,4
COMMENTS
The definition is based on the definition of pattern functions in the paper of Allouche and Shallit;
sum of n-th row = A029931(n);
T(n,1) = A000120(n);
T(n,2) = A033264(n) for n > 1;
T(n,3) = A014081(n) for n > 2;
T(n,4) = A056978(n) for n > 3;
T(n,5) = A056979(n) for n > 4;
T(n,6) = A056980(n) for n > 5;
T(n,7) = A014082(n) for n > 6;
T(n,k) = 0 for k with floor(n/2) < k < n;
T(n,n) = 1;
A005811(n) = T(n,1) + T(n,2) - T(n,3);
LINKS
Reinhard Zumkeller, Rows n = 1..150 of triangle, flattened
J.-P. Allouche, J. Shallit, The Ring of k-regular Sequences II, Example 4, p. 12
EXAMPLE
The triangle begins:
. 1: 1
. 2: 1 1
. 3: 2 0 1
. 4: 1 1 0 1
. 5: 2 1 0 0 1
. 6: 2 1 1 0 0 1
. 7: 3 0 2 0 0 0 1
. 8: 1 1 0 1 0 0 0 1
. 9: 2 1 0 1 0 0 0 0 1
. 10: 2 2 0 0 1 0 0 0 0 1
. 11: 3 1 1 0 1 0 0 0 0 0 1
. 12: 2 1 1 1 0 1 0 0 0 0 0 1.
MATHEMATICA
t[n_, k_] := (idn = IntegerDigits[n, 2]; idk = IntegerDigits[k, 2]; ln = Length[idn]; lk = Length[idk]; For[cnt = 0; i = 1, i <= ln - lk + 1, i++, If[idn[[i ;; i + lk - 1]] == idk, cnt++]]; cnt); Table[t[n, k], {n, 1, 14}, {k, 1, n}] // Flatten (* Jean-François Alcover, Oct 22 2012 *)
PROG
(Haskell)
import Data.List (inits, tails, isPrefixOf)
a213629 n k = a213629_tabl !! (n-1) !! (k-1)
a213629_row n = a213629_tabl !! (n-1)
a213629_tabl = map f $ tail $ inits $ tail $ map reverse a030308_tabf where
f xss = map (\xs ->
sum $ map (fromEnum . (xs `isPrefixOf`)) $ tails $ last xss) xss
CROSSREFS
KEYWORD
AUTHOR
Reinhard Zumkeller, Jun 17 2012
STATUS
approved