Give me the Gray Code list of bit width n The Gray Code is a sequence of binary numbers of bitwidth n where successive numbers differ only in one bit (see example output).

Reference

Example input:

3


Example output:

000
001
011
010
110
111
101
100


Notes:


This question seems to have a dupe but it's not, for that question is not a code-golf, and it demands different output. It will help to check out it's answers, though.
You may assume a variable n which contains the input.
JavaScript (77)

for(i=0;i&lt;1&lt;&lt;n;)alert((Array(n*n).join(0)+(i&gt;&gt;1^i++).toString(2)).substr(-n))


More browser-friendly version (console.log and prompt()):

n=prompt();for(i=0;i&lt;1&lt;&lt;n;)console.log((Array(n*n).join(0)+(i&gt;&gt;1^i++).toString(2)).substr(-n))