(This is my 200th post! =)

- algorithm algorithms approximation arithmetic art Babylonian beauty binary binomial coefficients book review bracelets carnival Carnival of Mathematics change chess chess board combinatorics consecutive cookies counting decadic decimal derivatives diagrams divisibility divisors education expansion factorization fibonacci floor foundations fractal fractions game games GIMPS graph graphs Haskell history humor hyperbinary idempotent integers integral interactive intuition irrational irrationality Ivan Niven latex logic Mersenne metric multiplication negative notation number numbers pi prime primes programming proof puzzle P vs NP rectangles repunit review sequence squares triangular video visualization
### Blogroll

### Fun

### Reference

### Categories

- algebra (14)
- arithmetic (35)
- books (25)
- calculus (6)
- challenges (46)
- combinatorics (6)
- complex numbers (3)
- computation (30)
- convergence (9)
- counting (28)
- famous numbers (38)
- fibonacci (14)
- fractals (12)
- games (17)
- geometry (27)
- golden ratio (8)
- group theory (3)
- humor (6)
- induction (7)
- infinity (17)
- iteration (15)
- links (70)
- logic (6)
- meta (37)
- modular arithmetic (10)
- number theory (47)
- open problems (11)
- paradox (1)
- pascal's triangle (8)
- pattern (54)
- people (19)
- pictures (28)
- posts without words (3)
- primes (23)
- probability (3)
- programming (15)
- proof (42)
- puzzles (10)
- recursion (8)
- review (17)
- sequences (26)
- solutions (24)
- teaching (9)
- trig (3)
- video (18)

### Archives

- December 2013 (1)
- October 2013 (1)
- July 2013 (1)
- June 2013 (1)
- May 2013 (1)
- April 2013 (3)
- March 2013 (3)
- February 2013 (2)
- January 2013 (5)
- December 2012 (3)
- November 2012 (4)
- October 2012 (5)
- September 2012 (1)
- August 2012 (4)
- July 2012 (1)
- June 2012 (6)
- May 2012 (2)
- April 2012 (3)
- March 2012 (1)
- February 2012 (4)
- January 2012 (5)
- December 2011 (1)
- November 2011 (7)
- October 2011 (4)
- September 2011 (6)
- July 2011 (2)
- June 2011 (4)
- May 2011 (5)
- April 2011 (2)
- March 2011 (4)
- February 2011 (1)
- January 2011 (1)
- December 2010 (1)
- November 2010 (4)
- October 2010 (2)
- September 2010 (1)
- August 2010 (1)
- July 2010 (1)
- June 2010 (2)
- May 2010 (3)
- April 2010 (1)
- February 2010 (6)
- January 2010 (3)
- December 2009 (8)
- November 2009 (7)
- October 2009 (3)
- September 2009 (3)
- August 2009 (1)
- June 2009 (4)
- May 2009 (5)
- April 2009 (4)
- March 2009 (2)
- February 2009 (1)
- January 2009 (7)
- December 2008 (1)
- October 2008 (2)
- September 2008 (7)
- August 2008 (1)
- July 2008 (1)
- June 2008 (1)
- April 2008 (5)
- February 2008 (4)
- January 2008 (4)
- December 2007 (3)
- November 2007 (12)
- October 2007 (2)
- September 2007 (4)
- August 2007 (3)
- July 2007 (1)
- June 2007 (3)
- May 2007 (1)
- April 2007 (4)
- March 2007 (3)
- February 2007 (7)
- January 2007 (1)
- December 2006 (2)
- October 2006 (2)
- September 2006 (6)
- July 2006 (4)
- June 2006 (2)
- May 2006 (6)
- April 2006 (3)
- March 2006 (6)

### Meta

=D

I indented the code by four spaces, as I thought you were using Markdown, but it looked terrible. Did you fix it up? If so, thanks!

Also, I like the seasonal colours in the diagram. :-)

Yep, I fixed it up, no worries. =) You can just surround code with <pre><code> … </code></pre>.

The one on the left is just counting in binary. Is the one on the right a Gray code?

Right you are!

I made something pretty using Gray code:

http://bendwavy.org/doodle/n2c-9.png

http://bendwavy.org/doodle/n3c-9.png

Cool! Can you explain how you made it?

Yes.

For each pixel, put its x,y coordinates in Gray code; deal out the bits to the color-channels, in one of a large number of possible ways; convert the result from Gray code. Gray code is not essential to the concept, but makes it prettier.

Thus for example the (Gray) coordinates’ bits might be

X = G7 B7 R6 G5 B5 R4 G3 B3 R2 G1 B1 R0

Y = R7 G6 B6 R5 G4 B4 R3 G2 B2 R1 G0 B0

or in other words the (Gray) color bits are

R = Y11 X9 Y8 X6 Y5 X3 Y2 X0

G = X11 Y10 X8 Y7 X5 Y4 X2 Y1

B = X10 Y9 X7 Y6 X4 Y3 X1 Y0

(I forgot that I had already posted bigger versions on G+.)

Ah, I see. Neat!