Re:[Stack Overflow]Design a function f, such that f(f(n)) ==...
by pfortuny on Tuesday June 25, 2013 @08:49AM
(#5939028)
I guess you do not understand my formula...
Given z a non-zero integer, either z=2n or z=2n-1 or z=-2n or z=-(2n-1), for some natural n>0... f(n) is defined according to each case. Uhu? And AFAIK f(f(n))=-n.
This should not be too hard to express in 32 bit arithmetic. With bitwise shifts etc.
Given z a non-zero integer, either z=2n or z=2n-1 or z=-2n or z=-(2n-1), for some natural n>0... f(n) is defined according to each case. Uhu? And AFAIK f(f(n))=-n.
This should not be too hard to express in 32 bit arithmetic. With bitwise shifts etc.