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.

A174600 T(n,k) = 1 if the sum of +-k..+-n with arbitrary signs never equals zero, = 0 otherwise (lower triangle).

Original entry on oeis.org

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, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1
Offset: 1

Views

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

Keywords

Examples

			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; ...
		

Crossrefs

Related to A063865.

Programs

  • 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;
    }
    
  • 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 *)
  • 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();
     ); }