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 »
Challenges

Post History

66%
+2 −0
Challenges Prove commutativity on this monoid presentation.

Given two binary strings $A$ and $B$ such that $A$ is an anagram of $B$, output a third binary string $S$ such that both $A$ and $B$ can be created by iterated removals of the substring $10101$ fro...

0 answers  ·  posted 1y ago by WheatWizard‭

#1: Initial revision by user avatar WheatWizard‭ · 2023-06-23T23:59:20Z (over 1 year ago)
Prove commutativity on this monoid presentation.
Given two binary strings $A$ and $B$ such that $A$ is an anagram of $B$, output a third binary string $S$ such that both $A$ and $B$ can be created by iterated removals of the substring $10101$ from $S$.

For example for $A=100$ and $B = 010$, one solution is $S = 10101010$
 since

$$
(10101)010 \rightarrow 010
$$
$$
10(10101)0 \rightarrow 100
$$

For a more complex example if $A = 1100$ and $B = 0101$, then one solution is $S = 11010101010101$ since

$$
110(10101)010101 \rightarrow 1100(10101) \rightarrow 1100
$$
$$
1(10101)01010101 \rightarrow (10101)0101 \rightarrow 0101
$$

There are multiple solutions to every possible input, but there is no requirement that the output be any particular one, only that it satisfy the requirements.

This is code-golf, the goal is to minimize the size of your source code as measured in bytes.