login
Sierpiński's triangle, read by rows, starting from 1: T(n,k) = (T(n-1,k) + T(n-1,k-1)) mod 2.
4

%I #28 Aug 24 2024 06:05:14

%S 1,0,1,1,1,1,0,0,0,1,1,0,0,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,

%T 0,1,1,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,

%U 0,1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1

%N Sierpiński's triangle, read by rows, starting from 1: T(n,k) = (T(n-1,k) + T(n-1,k-1)) mod 2.

%C Row sums give A038573.

%H G. C. Greubel, <a href="/A090971/b090971.txt">Rows n = 1..100 of triangle, flattened</a>

%F From _Philippe Deléham_, Feb 29 2004: (Start)

%F Triangle A047999(n, k) for n,k > 0; A047999: Pascal's triangle mod 2.

%F a(n) = A062534(n-1) mod 2.

%F T(n-1, k-1) = A074909(n, n-k) mod 2. (End)

%F T(n, k) = 1 if bitand(n, k) = k, and 0 otherwise. - _Amiram Eldar_, Aug 24 2024

%e Triangle begins with:

%e 1;

%e 0, 1;

%e 1, 1, 1;

%e 0, 0, 0, 1;

%e 1, 0, 0, 1, 1;

%e 0, 1, 0, 1, 0, 1;

%e 1, 1, 1, 1, 1, 1, 1; ...

%t T[n_, k_]:= T[n, k]= If[k<0 || k>n, 0, If[k==n, 1, Mod[T[n-1,k] + T[n-1, k-1], 2]]]; Table[T[n, k], {n,1,10}, {k,1,n}] (* _G. C. Greubel_, Feb 03 2019 *)

%t Table[Boole[BitAnd[n, k] == k], {n, 1, 14}, {k, 1, n}] // Flatten (* _Amiram Eldar_, Aug 24 2024 *)

%o (PARI) T(n,k)=if(k<0 || k>n, 0, if(n==0, 1, (T(n-1,k)+T(n-1,k-1))%2))

%Y Cf. A007318, A038573, A047999, A062534, A074909.

%K nonn,tabl

%O 1,1

%A _Benoit Cloitre_, Feb 28 2004