|
|
A213629
|
|
In binary representation: T(n,k) = number of (possibly overlapping) occurrences of k in n, triangle read by rows, 1<=k<=n.
|
|
11
|
|
|
1, 1, 1, 2, 0, 1, 1, 1, 0, 1, 2, 1, 0, 0, 1, 2, 1, 1, 0, 0, 1, 3, 0, 2, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 0, 0, 1, 2, 2, 0, 0, 1, 0, 0, 0, 0, 1, 3, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 3, 1, 1, 0, 1, 1, 0, 0
(list;
table;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,4
|
|
COMMENTS
|
The definition is based on the definition of pattern functions in the paper of Allouche and Shallit;
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
|
|
|
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
|
|
|
STATUS
|
approved
|
|
|
|