Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Incubator Q&A

Welcome to the staging ground for new communities! Each proposal has a description in the "Descriptions" category and a body of questions and answers in "Incubator Q&A". You can ask questions (and get answers, we hope!) right away, and start new proposals.

Are you here to participate in a specific proposal? Click on the proposal tag (with the dark outline) to see only posts about that proposal and not all of the others that are in progress. Tags are at the bottom of each post.

Place numbers around a circle to make all length 3 binary strings. Question

+2
−0

There are 8 binary strings of length 3.

They are:

000
001
010
011
100
101
110
111

The goal of this puzzle is to arrange some 0’s and some 1’s around a circle (using as few 0’s and 1’s as possible) so that all 8 binary strings listed above appear at least once around the circle.

A binary string is considered to appear around the circle if the 3 numbers of the binary string are located in three consecutive clockwise positions around the circle.

In the example below, the binary string 110 appears starting at the 1 marked with a star. But the binary string 101 does not appear anywhere.

5 numbers arranged around a circle.  Starting clockwise from the top, they are 0, 1*, 1, 0, 0

History

1 comment thread

Presumably you want the optimal solution, with the fewest numbers. This is just a de Bruijn sequence.... (2 comments)

2 answers

+2
−0

There is already an answer, so I'll show a way the answer can be derived with simple logic without requiring fancy math most here have probably never heard of.

Since there are 8 unique patterns, there must be at least 8 positions in the circle. Each position is then the starting point for one of the 3-digit patterns. At this point we don't know that the problem can be solved with only 8 digits (circle positions), but we know trying for less is pointless. We will therefore try with 8 digits, at least to start.

Since the 8 required patterns include 000 and 111, those must each appear in the final 8-digit sequences. This leaves us with only three options:

000111--
000-111-
000--111

Of these, we can rule out the middle one. No matter what we set the remaining unknown digits to, we won't be able to get 101 and 010. That leaves:

000111--
000--111

Given these sequences, there is only one way each can be filled in so that the pattern 101 exists:

00011101
00010111

If 8 digits is enough, then at least one of these sequences must work.

After checking all 8 patterns against these sequences, we find that they both work.

Note that since the digits are supposed to be arranged in a circle, which has no start or end, any rotation of a sequence is really the same sequence. For example, the following are all the same:

00011101
10001110
01000111
10100011
11010001
11101000
01110100
00111010

Of course this also applies to the other sequence. We can see that the two sequences are therefore the same as in Moshi's answer.

History

0 comment threads

+1
−0

This can be considered a de Bruijn sequence, specifically $B(2,3)$, which has two solutions: $00010111$ and $11101000$.

History

0 comment threads

Sign up to answer this question »