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.

A246830 T(n,k) is the concatenation of n-k and n+k in binary; triangle T(n,k), n>=0, 0<=k<=n, read by rows.

This page as a plain text file.
%I A246830 #30 May 22 2025 10:21:40
%S A246830 0,3,2,10,7,4,15,20,13,6,36,29,22,15,8,45,38,31,40,25,10,54,47,72,57,
%T A246830 42,27,12,63,104,89,74,59,44,29,14,136,121,106,91,76,61,46,31,16,153,
%U A246830 138,123,108,93,78,63,80,49,18,170,155,140,125,110,95,144,113,82,51,20
%N A246830 T(n,k) is the concatenation of n-k and n+k in binary; triangle T(n,k), n>=0, 0<=k<=n, read by rows.
%H A246830 Alois P. Heinz, <a href="/A246830/b246830.txt">Rows n = 0..127, flattened</a>
%e A246830 Triangle T(n,k) begins:
%e A246830    0
%e A246830    3  2
%e A246830   10  7  4
%e A246830   15 20 13  6
%e A246830   36 29 22 15  8
%e A246830   45 38 31 40 25 10
%e A246830   54 47 72 57 42 27 12
%e A246830 Triangle T(n,k) written in binary (with | denoting the concat operation) begins:
%e A246830      |0
%e A246830     1|1      |10
%e A246830    10|10    1|11     |100
%e A246830    11|11   10|100   1|101    |110
%e A246830   100|100  11|101  10|110   1|111    |1000
%e A246830   101|101 100|110  11|111  10|1000  1|1001  |1010
%e A246830   110|110 101|111 100|1000 11|1001 10|1010 1|1011 |1100
%p A246830 f:= proc(i, j) local r, h, k; r:=0; h:=0; k:=j;
%p A246830       while k>0 do r:=r+2^h*irem(k, 2, 'k'); h:=h+1 od; k:=i;
%p A246830       while k>0 do r:=r+2^h*irem(k, 2, 'k'); h:=h+1 od; r
%p A246830     end:
%p A246830 T:= (n, k)-> f(n-k, n+k):
%p A246830 seq(seq(T(n, k), k=0..n), n=0..14);
%t A246830 f[i_, j_] := Module[{r, h, k, m}, r=0; h=0; k=j; While[k>0, {k, m} = QuotientRemainder[k, 2]; r = r+2^h*m; h = h+1]; k=i; While[k>0, {k, m} = QuotientRemainder[k, 2]; r = r+2^h*m; h = h+1]; r]; T[n_, k_] := f[n-k, n+k]; Table[Table[T[n, k], {k, 0, n}], {n, 0, 14}] // Flatten (* _Jean-François Alcover_, Oct 03 2016, adapted from Maple *)
%o A246830 (Haskell)
%o A246830 import Data.Function (on)
%o A246830 a246830 n k = a246830_tabl !! n !! k
%o A246830 a246830_row n = a246830_tabl !! n
%o A246830 a246830_tabl = zipWith (zipWith f) a051162_tabl a025581_tabl where
%o A246830    f x y = foldr (\b v -> 2 * v + b) 0 $ x |+| y
%o A246830    (|+|) = (++) `on` a030308_row
%o A246830 -- _Reinhard Zumkeller_, Sep 04 2014
%o A246830 (Python)
%o A246830 A246830 = []
%o A246830 for n in range(10**2):
%o A246830     for k in range(n):
%o A246830         A246830.append(int(bin(n-k)[2:]+bin(n+k)[2:],2))
%o A246830     A246830.append(2*n) # _Chai Wah Wu_, Sep 05 2014
%Y A246830 Column k=0 gives A020330.
%Y A246830 T(n+1,n) gives A080565(n+1).
%Y A246830 T(2n,n) gives A246831.
%Y A246830 Main diagonal gives A005843.
%Y A246830 Cf. A007088, A030308, A051162, A025581, A246520 (row maxima).
%K A246830 nonn,tabl,base,look,nice
%O A246830 0,2
%A A246830 _Alois P. Heinz_, Sep 04 2014