Generate the list [1, 0, -1, 0, 1, 0, -1, 0, ...]
Ruby, 26 characters
a=-&gt;n{1-(k=n-n/4*4)+k/3*2}

Example:
&gt; p (0..10).map{|n| a[n]}
[1, 0, -1, 0, 1, 0, -1, 0, 1, 0, -1]

Note: This solution assumes that integer division / is an allowed operation.