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.

A213629 In binary representation: T(n,k) = number of (possibly overlapping) occurrences of k in n, triangle read by rows, 1<=k<=n.

This page as a plain text file.
%I A213629 #15 Oct 27 2024 06:11:28
%S A213629 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,
%T A213629 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,
%U A213629 1,1,0,1,0,0,0,0,0,1,3,1,1,0,1,1,0,0
%N A213629 In binary representation: T(n,k) = number of (possibly overlapping) occurrences of k in n, triangle read by rows, 1<=k<=n.
%C A213629 The definition is based on the definition of pattern functions in the paper of Allouche and Shallit;
%C A213629 sum of n-th row = A029931(n);
%C A213629 T(n,1) = A000120(n);
%C A213629 T(n,2) = A033264(n) for n > 1;
%C A213629 T(n,3) = A014081(n) for n > 2;
%C A213629 T(n,4) = A056978(n) for n > 3;
%C A213629 T(n,5) = A056979(n) for n > 4;
%C A213629 T(n,6) = A056980(n) for n > 5;
%C A213629 T(n,7) = A014082(n) for n > 6;
%C A213629 T(n,k) = 0 for k with floor(n/2) < k < n;
%C A213629 T(n,n) = 1;
%C A213629 A122953(n) = Sum_{k=1..n} A057427(T(n,k));
%C A213629 A005811(n) = T(n,1) + T(n,2) - T(n,3);
%C A213629 A007302(n) = A000120(n) - sum (A213629(n,A136412(k))).
%H A213629 Reinhard Zumkeller, <a href="/A213629/b213629.txt">Rows n = 1..150 of triangle, flattened</a>
%H A213629 J.-P. Allouche, J. Shallit, <a href="http://www.math.jussieu.fr/~allouche/kreg2.ps">The Ring of k-regular Sequences II, Example 4, p. 12</a>
%H A213629 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%e A213629 The triangle begins:
%e A213629 .   1:                        1
%e A213629 .   2:                      1   1
%e A213629 .   3:                    2   0   1
%e A213629 .   4:                  1   1   0   1
%e A213629 .   5:                2   1   0   0   1
%e A213629 .   6:              2   1   1   0   0   1
%e A213629 .   7:            3   0   2   0   0   0   1
%e A213629 .   8:          1   1   0   1   0   0   0   1
%e A213629 .   9:        2   1   0   1   0   0   0   0   1
%e A213629 .  10:      2   2   0   0   1   0   0   0   0   1
%e A213629 .  11:    3   1   1   0   1   0   0   0   0   0   1
%e A213629 .  12:  2   1   1   1   0   1   0   0   0   0   0   1.
%t A213629 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 *)
%o A213629 (Haskell)
%o A213629 import Data.List (inits, tails, isPrefixOf)
%o A213629 a213629 n k = a213629_tabl !! (n-1) !! (k-1)
%o A213629 a213629_row n = a213629_tabl !! (n-1)
%o A213629 a213629_tabl = map f $ tail $ inits $ tail $ map reverse a030308_tabf where
%o A213629    f xss = map (\xs ->
%o A213629            sum $ map (fromEnum . (xs `isPrefixOf`)) $ tails $ last xss) xss
%Y A213629 Cf. A030308, A007088.
%K A213629 nonn,base,tabl
%O A213629 1,4
%A A213629 _Reinhard Zumkeller_, Jun 17 2012