Wikipedia:Reference desk/Archives/Mathematics/2017 May 10

= May 10 =

Reversible Math Function
I am doing a presentation and I want to really dumb down a part of it. To do so, I need a function f(x,y) such that if you feed it a value for x and y, you get a value z. It is a one-to-one function. between y and z. If you keep x the same and change y, you will never get z for two different values of y. Now, the hard part. If I use f(x,z), I get y. It should be obvious that this is a symmetrical key encryption function. Using the key x for y, I get z. Using the key x for z, I get y. I would like something that remains in the realm of integers so the audience can perform the function on a number, like 123, and get a number, like 42. Then, they can perform the function on 42 and get 123. Finally, they can change the key and see that 123 gives 4018 and 42 gives 3317. The problem is that the only formulas that I can find that meet this criteria are far too complicated for an audience to do in a few seconds or are string functions (swapping the positions of the digits). 209.149.113.5 (talk) 13:38, 10 May 2017 (UTC)
 * Reformulation of the problem for those who prefer mathrspeak: find $$f:x,y\rightarrow z$$ such that
 * $$\forall x, f_x: y \rightarrow f(x,y)$$ is injective
 * $$\forall x,y, f(x,f(x,y)) = y$$
 * Tigraan Click here to contact me 08:05, 11 May 2017 (UTC)
 * The function
 * f(x,y) = (2,000,000 - y) * something_weird(x)
 * seems to meet criteria.. --CiaPan (talk) 13:56, 10 May 2017 (UTC)


 * Thank you, but I think that I am misreading this. Assume what "something_weird(x)" just returns x. Then, if x=6 and y=123, I get (2000000-123)*6 = 11999262. So, I try it with the result. (2000000-11999262)*6 = -59995572. The goal is for the result of f(x,y) to be symmetrical - meaning that f(x,f(x,y)) = y. 209.149.113.5 (talk) 18:14, 10 May 2017 (UTC)


 * Maybe z = y+ x (mod 2x)? Loraof (talk) 19:10, 10 May 2017 (UTC)


 * What about
 * $$ f(x,y) = (165x - y)(19x-18). $$
 * which satisfies $$f(1,123)=42$$, $$f(1,42)=123$$ but $$f(2,123)=4140$$ and $$f(2,42)= 5760$$. I chose this one to be near(ish) to your example, but you can make variants of a similar form,
 * $$ f(x,y) = [165a(x) - y]b(x), $$
 * where $$a(x)$$ and $$b(x)$$ are integer functions satisfying $$a(1)=b(1)=1$$. 92.18.69.92 (talk) 19:19, 10 May 2017 (UTC)


 * But f(2, 4140) ≠ 123, so as I understand the question this doesn't work. Loraof (talk) 19:33, 10 May 2017 (UTC)
 * Ah. So if the symmetric property has to be kept for all $$x$$ you can get rid of the $$b(x)$$ function. Like: $$f(x,y) = c(x) - y, $$ for any integer function c(x). For a given $$x$$, it's always an involution, so symmetric. But the pairs $$(y,z)$$ change depending on $$x$$. 92.18.69.92 (talk) 20:04, 10 May 2017 (UTC)


 * Thank you all. While I was initially looking for a simple integer function, my wife told me that I needed to do it digit by digit to help baby-step the audience to bitwise operations. So, I took these suggestions and applied it digit by digit with, per digit: z = (2x-y)%10. For the example of x=6 and y=123, x is actually 006 (left-pad zero). z_1 = (2*6-3)%10 = 9. z_10 = (2*0-2)%10 = 8. Note, -n%10 is not the same as |-n|%10. There are two ways to handle negative mod. z_100 = (2*0-1)%10 = 9. So, z=989. Now, if I let y=989 and x=6, I should get z=123. z_1 = (2*6-9)%10 = 3. z_10 = (2*0-8)%10 = 2. z_100 = (2*0-9)%10 = 1. z=123. 209.149.113.5 (talk) 12:28, 11 May 2017 (UTC)

Numbers with a given totient number
Given n (and its factorization) is there a direct way to find the numbers, x, such that phi(x)=n? Bubba73 You talkin' to me? 16:24, 10 May 2017 (UTC)


 * I may have found a way - I've downloaded some papers to read... Bubba73 You talkin' to me? 16:58, 10 May 2017 (UTC)