OFFSET
0,2
LINKS
Alois P. Heinz, Rows n = 0..127, flattened
EXAMPLE
Triangle T(n,k) begins:
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 42 27 12
Triangle T(n,k) written in binary (with | denoting the concat operation) begins:
|0
1|1 |10
10|10 1|11 |100
11|11 10|100 1|101 |110
100|100 11|101 10|110 1|111 |1000
101|101 100|110 11|111 10|1000 1|1001 |1010
110|110 101|111 100|1000 11|1001 10|1010 1|1011 |1100
MAPLE
f:= proc(i, j) local r, h, k; r:=0; h:=0; k:=j;
while k>0 do r:=r+2^h*irem(k, 2, 'k'); h:=h+1 od; k:=i;
while k>0 do r:=r+2^h*irem(k, 2, 'k'); h:=h+1 od; r
end:
T:= (n, k)-> f(n-k, n+k):
seq(seq(T(n, k), k=0..n), n=0..14);
MATHEMATICA
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 *)
PROG
(Haskell)
import Data.Function (on)
a246830 n k = a246830_tabl !! n !! k
a246830_row n = a246830_tabl !! n
a246830_tabl = zipWith (zipWith f) a051162_tabl a025581_tabl where
f x y = foldr (\b v -> 2 * v + b) 0 $ x |+| y
(|+|) = (++) `on` a030308_row
-- Reinhard Zumkeller, Sep 04 2014
(Python)
A246830 = []
for n in range(10**2):
....for k in range(n):
........A246830.append(int(bin(n-k)[2:]+bin(n+k)[2:], 2))
....A246830.append(2*n) # Chai Wah Wu, Sep 05 2014
CROSSREFS
AUTHOR
Alois P. Heinz, Sep 04 2014
STATUS
approved