Count up in Gray code!

For all your silly time-killing forum games.

Moderators: jestingrabbit, Moderators General, Prelates

User avatar
Link
Posts: 1399
Joined: Sat Mar 07, 2009 11:33 am UTC
Location: ᘝᓄᘈᖉᐣ
Contact:

Count up in Gray code!

Postby Link » Wed Aug 12, 2009 9:20 pm UTC

Keeping in line with the other counting topics, here's one for Gray code. (Standard BRGC, adding bits as needed.)

I'll start: 0.

User avatar
Max2009
Posts: 160
Joined: Mon Mar 09, 2009 2:20 pm UTC
Location: Where?
Contact:

Re: Count up in Gray code!

Postby Max2009 » Wed Aug 12, 2009 9:22 pm UTC

1
Cogito ergo surf - I think therefore I network

Registered Linux user #481826 Get Counted! http://counter.li.org

Image

User avatar
Link
Posts: 1399
Joined: Sat Mar 07, 2009 11:33 am UTC
Location: ᘝᓄᘈᖉᐣ
Contact:

Re: Count up in Gray code!

Postby Link » Wed Aug 12, 2009 9:26 pm UTC

11

User avatar
Max2009
Posts: 160
Joined: Mon Mar 09, 2009 2:20 pm UTC
Location: Where?
Contact:

Re: Count up in Gray code!

Postby Max2009 » Wed Aug 12, 2009 9:27 pm UTC

10
Cogito ergo surf - I think therefore I network

Registered Linux user #481826 Get Counted! http://counter.li.org

Image

User avatar
Link
Posts: 1399
Joined: Sat Mar 07, 2009 11:33 am UTC
Location: ᘝᓄᘈᖉᐣ
Contact:

Re: Count up in Gray code!

Postby Link » Wed Aug 12, 2009 9:44 pm UTC

110

User avatar
Max2009
Posts: 160
Joined: Mon Mar 09, 2009 2:20 pm UTC
Location: Where?
Contact:

Re: Count up in Gray code!

Postby Max2009 » Wed Aug 12, 2009 10:39 pm UTC

111
Cogito ergo surf - I think therefore I network

Registered Linux user #481826 Get Counted! http://counter.li.org

Image

User avatar
Lorenz
Posts: 27
Joined: Fri Apr 29, 2011 5:57 am UTC

Re: Count up in Gray code!

Postby Lorenz » Mon Oct 10, 2011 3:55 am UTC

101

User avatar
AvatarIII
Posts: 2098
Joined: Fri Apr 08, 2011 12:28 pm UTC
Location: W.Sussex, UK

Re: Count up in Gray code!

Postby AvatarIII » Mon Oct 10, 2011 10:07 am UTC

100

User avatar
Lorenz
Posts: 27
Joined: Fri Apr 29, 2011 5:57 am UTC

Re: Count up in Gray code!

Postby Lorenz » Tue Oct 11, 2011 5:03 am UTC

1100

User avatar
Jplus
Posts: 1721
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: Count up in Gray code!

Postby Jplus » Tue Oct 11, 2011 10:52 am UTC

Nice code. :)

Aren't we jumping to more bits a bit too fast? After all we could have cycled through all 2-bit words before going to 3-bit and similarly from 3-bit to 4-bit...
Like this: 1, 11, 10, 00, 01, 101, 111, 110, 100, 000, 001, 011, 010, 1010...

Anyway, I suppose after 1100 comes 1110.
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
Lorenz
Posts: 27
Joined: Fri Apr 29, 2011 5:57 am UTC

Re: Count up in Gray code!

Postby Lorenz » Tue Oct 11, 2011 1:28 pm UTC

well, no zeroes to the left mean the switches are off, so 1 = 01 = 001

Also, to generate the code, start with both bits

0 , 1

mirror them

0 , 1 , 1 , 0

add zeroes o the first bits, and ones to the seocnd bits

00 , 01, 11, 10

repeat

00 , 01, 11, 10 , 10 , 11 , 01 , 00

000 , 001, 011, 010 , 110 , 111 , 101 , 100

... 1100, 1101, 1111, 1110, 1010, 1011, 1001, 1000

So you number would have been 1101 and mine

1111

User avatar
Jplus
Posts: 1721
Joined: Wed Apr 21, 2010 12:29 pm UTC
Location: Netherlands

Re: Count up in Gray code!

Postby Jplus » Tue Oct 11, 2011 1:45 pm UTC

Ah right, of course. How silly of me.

1110
"There are only two hard problems in computer science: cache coherence, naming things, and off-by-one errors." (Phil Karlton and Leon Bambrick)

coding and xkcd combined

(Julian/Julian's)

User avatar
Lorenz
Posts: 27
Joined: Fri Apr 29, 2011 5:57 am UTC

Re: Count up in Gray code!

Postby Lorenz » Tue Oct 11, 2011 2:11 pm UTC

1010

User avatar
Sean Quixote
Posts: 229
Joined: Tue Sep 14, 2010 1:20 am UTC
Location: Ubeki-beki-beki-beki-stan-stan

Re: Count up in Gray code!

Postby Sean Quixote » Tue Oct 11, 2011 10:30 pm UTC

1011

A_pathetic_lizardmnan
Posts: 69
Joined: Wed Jul 08, 2009 2:37 am UTC

Re: Count up in Gray code!

Postby A_pathetic_lizardmnan » Thu Oct 13, 2011 7:05 pm UTC

1001

almost to five digits...

User avatar
Sean Quixote
Posts: 229
Joined: Tue Sep 14, 2010 1:20 am UTC
Location: Ubeki-beki-beki-beki-stan-stan

Re: Count up in Gray code!

Postby Sean Quixote » Thu Oct 13, 2011 7:42 pm UTC

1000

User avatar
Lorenz
Posts: 27
Joined: Fri Apr 29, 2011 5:57 am UTC

Re: Count up in Gray code!

Postby Lorenz » Fri Oct 14, 2011 2:40 am UTC

11000

User avatar
Sean Quixote
Posts: 229
Joined: Tue Sep 14, 2010 1:20 am UTC
Location: Ubeki-beki-beki-beki-stan-stan

Re: Count up in Gray code!

Postby Sean Quixote » Fri Oct 14, 2011 2:43 am UTC

11100

User avatar
Lorenz
Posts: 27
Joined: Fri Apr 29, 2011 5:57 am UTC

Re: Count up in Gray code!

Postby Lorenz » Fri Oct 14, 2011 3:11 am UTC

are you sure?

User avatar
Sean Quixote
Posts: 229
Joined: Tue Sep 14, 2010 1:20 am UTC
Location: Ubeki-beki-beki-beki-stan-stan

Re: Count up in Gray code!

Postby Sean Quixote » Fri Oct 14, 2011 7:22 am UTC

No, I am not. =\

Please allow me to better familiarize myself with this -- I had to guess because I could no longer cheat off the Wikipedia article... :P

User avatar
faubiguy
Posts: 15
Joined: Sun Aug 11, 2013 9:20 am UTC

Re: Count up in Gray code!

Postby faubiguy » Mon Dec 15, 2014 2:44 am UTC

11001

User avatar
azule
Saved
Posts: 2132
Joined: Mon Jul 26, 2010 9:45 pm UTC
Location: The land of the Golden Puppies and Rainbows

Re: Count up in Gray code!

Postby azule » Mon Dec 15, 2014 3:23 am UTC

Neat one.

11011
Image

If you read this sig, post about one arbitrary thing you did today.

I celebrate up to six arbitrary things before breakfast.
Time does drag on and on and contain spoilers. Be aware of memes.

User avatar
faubiguy
Posts: 15
Joined: Sun Aug 11, 2013 9:20 am UTC

Re: Count up in Gray code!

Postby faubiguy » Mon Dec 15, 2014 3:30 am UTC

11010

User avatar
Vytron
Posts: 429
Joined: Mon Oct 19, 2009 10:11 am UTC
Location: The Outside. I use She/He/Her/His/Him as gender neutral pronouns :P

Re: Count up in Gray code!

Postby Vytron » Mon Dec 15, 2014 12:09 pm UTC

11110

Cheat sheet
Spoiler:
5bit
00000
00001
00011
00010
00110
00111
00101
00100
01100
01101
01111
01110
01010
01011
01001
01000
11000
11001
11011
11010
11110
11111
11101
11100
10100
10101
10111
10110
10010
10011
10001
10000

User avatar
faubiguy
Posts: 15
Joined: Sun Aug 11, 2013 9:20 am UTC

Re: Count up in Gray code!

Postby faubiguy » Mon Dec 15, 2014 12:15 pm UTC

11111

User avatar
Vytron
Posts: 429
Joined: Mon Oct 19, 2009 10:11 am UTC
Location: The Outside. I use She/He/Her/His/Him as gender neutral pronouns :P

Re: Count up in Gray code!

Postby Vytron » Mon Dec 15, 2014 12:17 pm UTC

11101

User avatar
faubiguy
Posts: 15
Joined: Sun Aug 11, 2013 9:20 am UTC

Re: Count up in Gray code!

Postby faubiguy » Mon Dec 15, 2014 12:30 pm UTC

11100

User avatar
Vytron
Posts: 429
Joined: Mon Oct 19, 2009 10:11 am UTC
Location: The Outside. I use She/He/Her/His/Him as gender neutral pronouns :P

Re: Count up in Gray code!

Postby Vytron » Mon Dec 15, 2014 12:52 pm UTC

10100

User avatar
faubiguy
Posts: 15
Joined: Sun Aug 11, 2013 9:20 am UTC

Re: Count up in Gray code!

Postby faubiguy » Mon Dec 15, 2014 1:00 pm UTC

10101

User avatar
Vytron
Posts: 429
Joined: Mon Oct 19, 2009 10:11 am UTC
Location: The Outside. I use She/He/Her/His/Him as gender neutral pronouns :P

Re: Count up in Gray code!

Postby Vytron » Mon Dec 15, 2014 1:03 pm UTC

10111

User avatar
faubiguy
Posts: 15
Joined: Sun Aug 11, 2013 9:20 am UTC

Re: Count up in Gray code!

Postby faubiguy » Mon Dec 15, 2014 1:15 pm UTC

10110

User avatar
Vytron
Posts: 429
Joined: Mon Oct 19, 2009 10:11 am UTC
Location: The Outside. I use She/He/Her/His/Him as gender neutral pronouns :P

Re: Count up in Gray code!

Postby Vytron » Mon Dec 15, 2014 1:36 pm UTC

10010

User avatar
faubiguy
Posts: 15
Joined: Sun Aug 11, 2013 9:20 am UTC

Re: Count up in Gray code!

Postby faubiguy » Mon Dec 15, 2014 1:45 pm UTC

10011

User avatar
Vytron
Posts: 429
Joined: Mon Oct 19, 2009 10:11 am UTC
Location: The Outside. I use She/He/Her/His/Him as gender neutral pronouns :P

Re: Count up in Gray code!

Postby Vytron » Mon Dec 15, 2014 1:57 pm UTC

10001

User avatar
faubiguy
Posts: 15
Joined: Sun Aug 11, 2013 9:20 am UTC

Re: Count up in Gray code!

Postby faubiguy » Mon Dec 15, 2014 2:01 pm UTC

10000

User avatar
Vytron
Posts: 429
Joined: Mon Oct 19, 2009 10:11 am UTC
Location: The Outside. I use She/He/Her/His/Him as gender neutral pronouns :P

Re: Count up in Gray code!

Postby Vytron » Mon Dec 15, 2014 2:06 pm UTC

110000

Cheat sheet
Spoiler:
6bit (to see previous entries just add a 0 at the left of the previous list)
110000
110001
110011
110010
110110
110111
110101
110100
111100
111101
111111
111110
111010
111011
111001
111000
101000
101001
101011
101010
101110
101111
101101
101100
100100
100101
100111
100110
100010
100011
100001
100000

User avatar
faubiguy
Posts: 15
Joined: Sun Aug 11, 2013 9:20 am UTC

Re: Count up in Gray code!

Postby faubiguy » Mon Dec 15, 2014 2:15 pm UTC

110001

User avatar
Vytron
Posts: 429
Joined: Mon Oct 19, 2009 10:11 am UTC
Location: The Outside. I use She/He/Her/His/Him as gender neutral pronouns :P

Re: Count up in Gray code!

Postby Vytron » Mon Dec 15, 2014 2:45 pm UTC

110011

User avatar
faubiguy
Posts: 15
Joined: Sun Aug 11, 2013 9:20 am UTC

Re: Count up in Gray code!

Postby faubiguy » Mon Dec 15, 2014 3:00 pm UTC

110010

User avatar
Vytron
Posts: 429
Joined: Mon Oct 19, 2009 10:11 am UTC
Location: The Outside. I use She/He/Her/His/Him as gender neutral pronouns :P

Re: Count up in Gray code!

Postby Vytron » Mon Dec 15, 2014 3:03 pm UTC

110110


Return to “Forum Games”

Who is online

Users browsing this forum: No registered users and 34 guests