9
In this question I defined a "chain" function as a function that:
is a permutation, meaning that every value maps to and is mapped to by exactly one value.
and allows any value can be obtained from any other value by repeated applications of the function or its inverse.
There are a lot of functions that do this and some of them are pretty simple (see the answers on that question). Now we are going to define a separate class of functions I am going to call "interwoven" functions. An interwoven function is a function on a set A, that has two infinite partitions a0 and a1 such that the function is a chain function on both a0 and a1.
This means that no value in a0 can map to a value in a1 under the function or vice versa.
Task
Your task is to write a code that performs or defines an interwoven function on the positive integers. Your function can be anything as long as it satisfies the criteria for being interwoven. You should include a explanation as to why your function is interwoven in the answer.
This is a code-golf question so answers will be scored in bytes, with less bytes being better.
@flawr Thanks! I was looking for that word but I couldn't think of it. – Post Rock Garf Hunter – 2017-08-08T21:14:00.877
I think this could be considered a dupe of the last challenge you linked, as you just have to make an additional transfromation, i.e. enumerating all the even and all the odd numbers seperately. I don't think any of the answers you're getting here will provide anything substantially new. – flawr – 2017-08-08T21:17:09.857
@flawr You could do that, but it wouldn't be the best way. I've done a little experimentation with this and there are some novel ways to perform these types of functions. – Post Rock Garf Hunter – 2017-08-08T21:19:03.693