OFFSET
1,1
LINKS
R. H. Hardin, Table of n, a(n) for n=1..4950
EXAMPLE
Triangle begins
1;
1, 1;
0, 1, 1;
0, 1, 1, 1;
1, 0, 1, 1, 1;
1, 0, 0, 1, 1, 1;
0, 1, 1, 0, 1, 1, 1;
0, 1, 1, 0, 0, 1, 1, 1;
1, 0, 0, 1, 1, 0, 1, 1, 1;
1, 0, 0, 1, 1, 1, 0, 1, 1, 1; ...
MATHEMATICA
t[n_, k_] := If[Mod[Floor[(n+1)/2], 2] != Mod[Floor[k/2], 2], 1, If[Mod[n-k, 2] == 0, If[k > ((n-k)/2)^2, 1, 0], 0]]; Flatten[Table[t[n, k], {n, 1, 15}, {k, 1, n}]][[;; 108]] (* Jean-François Alcover, Jul 11 2011, after awk program *)
PROG
(AWK)
{ for(n=1; n<10; n++)
for(k=1; k<=n; k++)
print ++i, T(n, k);
}
function T(n, k) {
if ( int((n+1)/2)%2 != int(k/2)%2 ) return 1;
else if ( (n-k)%2 == 0 ) {
if ( k > ((n-k)/2)^2 ) return 1;
else return 0;
}
else return 0;
}
(PARI)
T(n, k)=
{
if ( ((n+1)\2)%2 != (k\2)%2,
return(1);
, /* else */
if ( (n-k)%2 == 0,
if ( k > ((n-k)/2)^2, return(1), return(0) );
, /* else */
return(0);
);
);
}
{ for(n=1, 10, /* show triangle */
for(k=1, n,
print1(T(n, k), ", ");
);
print();
); }
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
R. H. Hardin Mar 23 2010, with formula and reference from Franklin T. Adams-Watters and Olivier Gérard, on the Sequence Fans Mailing list.
STATUS
approved