Okay, you’re searching for a number of methods to signify the integers with customized symbols, with some invalid mixture.
As I mentioned within the feedback, one approach to do it’s to make a quantity base. So you probably have S symbols, you employ the numeric base S and you’re completed. On this setting any zeroes to the left might be thought of invalid combos.
Now, because you need a number of difficulties, I had to consider it a bit extra.
What if S is 1? Then all of the combos are the identical image repeated a number of instances. And thus the issue reduces to a mapping from pure numbers (what number of instances will we repeat the one image) to pure numbers.
Thus, I consider it’s truthful to separate the issue in three:
- signify integers with S symbols: That is already solved, you employ the S base
- map pure numbers to pure numbers with out creating collisions and leaving invalid entries
- And easy methods to make it tougher
So, for the mapping, it’s simpler if you consider it backwards: It isn’t easy methods to provide you with methods to mix the symbols in order that making use of some perform they provide the pure numbers… As an alternative it’s what perform do you apply to the pure numbers so that you get the pure numbers however skipping some, and the perform might be inverted.
The answer to that’s to make use of a linear perform. So you are taking the pure quantity, multiply by some worth, and add some offset. The inverted perform substracts some worth and divides. Not each enter offers you a pure quantity (both as a result of the subtraction offer you a destructive, or as a result of the division isn’t integer), these are your invalid combos. As as , the linear perform doesn’t have a number of options, so we all know there are not any collisions.
Now, to make it tougher, we may benefit from these operations… Issue 1: Simply Substract, Issue 2: Simply Divide, Issue 3: Do each.
Notice: you should utilize prime numbers to make it tougher to determine.
Nevertheless, I consider you are able to do extra. If the aim is to make it tougher to know the quantity, then we go to cryptography. I do not suppose a substitution cipher is of a lot use since we’re already coping with customized symbols. However you would rearrange the digits.
What’s rearranging? Nicely it’s a mapping from the unique place of the digit to the brand new place of the digit, so it’s one thing much like what we had been already doing. Nevertheless this time we do not need gaps. The answer is to make blocks and add padding. Then you are able to do no matter permutation you need contained in the block.
Now, your mapping could be:
- Revert the permutations
- Divide (some combos grow to be invalid right here as a result of they aren’t integer)
- Substract (some combos grow to be invalid right here as a result of they go destructive)
- Change of base (if it applies)
Addendum: I am now pondering it could be simpler to alter the bottom first after which function, that additionally works.
Thus, the issue you’re coping with is: Are you able to do math operations with numbers that has been encrypted? And sure, that could be a factor.
You could be fascinated with Homomorphic encryption, they don’t solely enable to do some computations with the encrypted values, however they permit to do these computations with out figuring out the values (so you are able to do the computation with out figuring out the inputs or the end result).