can anyone give me a function on the integer defined as $f_{n}(f_{n}(x))=x$ please?

72 Views Asked by At

I need a function $f_{n}$ wich for all integer n is an Involution on the integer.

Put in another way I need a function $f_{n}$ so that $f_{n}(f_{n}(x))=x$ for all integer x and n)

ps: And wich is as much as possible is "different" when given different n since this function is supposed to be used with x corresponding to a character to encode and n a corresponding to a character of the key.

3

There are 3 best solutions below

1
On BEST ANSWER

A classical example is $f_n(x) = x \oplus n$ where $\oplus$ is the binary XOR.

0
On

I dont not have enough reputations to do this request like a comment

I am not sure but what do you think about $f_n(x)=(-1)^nx $

0
On

How about $f_n(x)$ splits the integers into intervals of length $n$ and reverses each interval, i.e. $$ f_1(x) = 1,2,3,4,5,6,7,8,9,10,...\\ f_2(x) = 2,1,4,3,6,5,8,7,10,9,...\\ f_3(x) = 3,2,1,6,5,4,9,8,7,12...\\ f_4(x) = 4,3,2,1,8,7,6,5,12,11,...\\ f_5(x) = 5,4,3,2,1,10,9,8,7,6,... $$ and so on.