1

I am looking for a special function, which could change itself (for example other constants set) so that part of its output would change in a special way.

Let it be such that at the beginning, the function would be just identity x -> x for x in some finite range [0, n] , x € N After inserting the element n+1 to the position i < n the hash function must provide :

if x < i -> x (unchanged)

i -> n+1 (the inserted element)

i+1 .. n -> x+1 (other values, shifted by one)

Then, other elements are either added to the end or position beyond end ( no shift happens) or inserted ( with shift)

I guess this function must be something with modulo, maybe some sequence of addition of modulo ops like (a*x + b) mod k +- (c*x + d) mod m , etc

Like for example, let it be f = (k * x) mod 3 and k = 1 then f(x) = [0, 1,2] If we insert the new element to the position 1 and change k = 2, f = (2*x) mod 3 the result will be [0,2,1... but no 3 fail here...]

Found what may be a hint : if

a = (x) % 6
b = (x)% 5
c = x // 6

then for x < 10: a - b - c =5 -> 5 while rest is 0 maybe something like that

snamef
  • 11

1 Answers1

0

What you describe seems like a system with an internal state. For a function in the mathematical sense, if $f(10)=10$, then no matter how many time's I've used $f$, $f(10)$ will always be $10$.

For a C function, for instance, which may have static variables (i.e. variables whose values are kept between function calls, instead of being reset), the result of $f(10)$ may depend on these inner variables. And these static variable sare an "internal state" of this function.

Otherwise you may request such variables to be given at input such that you have $f(x,U) = (y, U')$, and on the next call you'd give the last output $U'$ as input.

Hope this helps.

Mefitico
  • 1,845
  • thats why i wrote with some parameters or with changing structure. And that was not mutch help, i m trying to figure out a formula – snamef Aug 02 '19 at 18:14
  • You're saying you want a a special hash function, but what for? It's hard to understand your requirements. – Mefitico Aug 02 '19 at 18:25