Suppose I have a sequence of numbers: {n, n+1, n+2, ... n + m}
Without storing the numbers ahead of time I want to create a function f(), which given the sequence {1,2,3
Your question is a bit confusing, as it sounds like you want to get all of the original sequence back, but then you have both 4 and 8 mapping to 10, and nothing mapping to 12.
If you actually meant that to be a 1:1 mapping, then what you are looking for is a random permutation of the original set. There are ways to do this with or without collecting up the set first (but you'll need something that generates it, or keep track of where you are).
Also, note that n is not important. You can always use 0,1,2,...m and then add n to everything if needed.
Assuming I've interpreted this correctly and you are actually looking for a shuffle algorithm (i.e. random permutation, called shuffles by analogy to shuffling a deck of cards), have a look at Fisher-Yates
[Edit] Ok, based on your update, the problem you face is this: You don't want to encode the permutation explicitly, but you must encode it somehow in order to construct f. The easiest way is just to actually store the permuted indices in an array, but if you don't want to do that for some reason (e.g. too big), you can encode it in various ways. There is no free lunch though, as there are information theoretic limits on how simple this can be. Anyway, you can get some ideas from looking up work on "encoding permutations" for example something like this paper