maconvert Posted June 23, 2014 Posted June 23, 2014 (edited) Hello, I'm working on a computer problem, but, before I waste too much time going down this road, I thought I should pick the brains of you math geniuses. Basically, I want to be able to represent any number between 1 billion and 42 trillion using just 4 characters (numbers and/or letters). This is what I've come up with so far... A^a + B^b + C^c + D^d = LARGE NUMBER a, b, c, & d are exponent variables that can range from 0 to 35 (0,1,2,...X,Y,Z) A, B, C, & D are bases that are integer constants that never change. Basically, if someone is given the 4 exponent values and the bases are already known, they can extrapolate the number value from that. For example, if I decided to always use A = 2, B = 3, C = 5, and D = 7, the exponent sequence Z9E2 would correspond to 2^26 + 3^9 + 5^14 + 7^2 = 6,170,644,221. So, what I want to know is this: Are there particular values of A, B, C, and D that, depending on the values of a, b, c, and d, can generate every single number between 1 billion and 42 trillion? Is there NO set of 4 base values that can generate every single number between 1 billion and 42 trillion? Will any values of A, B, C, and D work? I look forward to your replies. Thanks in advance! Edited June 23, 2014 by maconvert
imatfaal Posted June 23, 2014 Posted June 23, 2014 between 1 billion and 42 trillion or between 1 trillion ...? You mention both And after thinking about it - no way! Even if you choose the smallest set of integers 2,3,4,5 you have maximum values of their exponents as 45,28,22,19 respectively - otherwise you go over 42e12 with just one of the terms when the others are zero. ie 2^(0 up to 45) + 3^(0 up to 28) etc There is therefore an absolute max (and in fact it will be a lot smaller) of combos (45*28*22*19) - its just over 500k ignoring the fact these max exponent values are based on the others being zero. So it can only cover a tiny fraction of the numbers betwee 1e12 and 42e12 ---- you could get arbitrarily close if you allowed non-integer exponents - but what would be the point?
maconvert Posted June 23, 2014 Author Posted June 23, 2014 (edited) between 1 billion and 42 trillion or between 1 trillion ...? You mention both And after thinking about it - no way! Even if you choose the smallest set of integers 2,3,4,5 you have maximum values of their exponents as 45,28,22,19 respectively - otherwise you go over 42e12 with just one of the terms when the others are zero. ie 2^(0 up to 45) + 3^(0 up to 28) etc There is therefore an absolute max (and in fact it will be a lot smaller) of combos (45*28*22*19) - its just over 500k ignoring the fact these max exponent values are based on the others being zero. So it can only cover a tiny fraction of the numbers betwee 1e12 and 42e12 ---- you could get arbitrarily close if you allowed non-integer exponents - but what would be the point? The maximum exponent value would be 35 (36 total values including 0). I basically want to create an algorithm that runs through every combination of A^a + B^b + C^c + D^d (1,679,616 total possible equations) and compares each sum to the number I want to represent. When it finds a match, it generates the 4 character code (numbers and/or letters) and presents that to the user. I know that this is a relatively inefficient brute force method and I'm aware that a huge proportion of the results will fall outside of the range that I specified, but that's OK. The algorithm will quit when (if) it finds a match, but even if it takes 2 hours to arrive at a result, that's fine. Speed is not an issue in this case. BTW, to your point regarding the maximums, I guess if I use A = 2, B = 3, C = 5, and D = 7, then I should limit my exponents to 35, 28, 19, and 16 respectively. Edited June 23, 2014 by maconvert
Delta1212 Posted June 23, 2014 Posted June 23, 2014 36*36*36*36 = 1,679,616 So that gives you a little over 1.5 million possible 4 digit codes. At most, you could represent all of the numbers between 1 billion and 1.0016 billion with that scheme. Any more than that would require representing multiple numbers with the same code, which obviously doesn't work. You need a code with 41.999 trillion possible configurations to uniquely represent every possible number in your desired range.
imatfaal Posted June 23, 2014 Posted June 23, 2014 You really dont have that many as 5^20 is over 42e12. Even if you do run with 36^4 - just work them out and do a compare list. You could do it in MSExcel xposted with DeltaOneTwoOneTwo
maconvert Posted June 23, 2014 Author Posted June 23, 2014 (edited) You really dont have that many as 5^20 is over 42e12. Even if you do run with 36^4 - just work them out and do a compare list. You could do it in MSExcel xposted with DeltaOneTwoOneTwo Now, that I've eliminated exponents that are over the maximum, the number of equations is 354,960. The bottom line, and this is not a deal breaker, is that the number I want to encode into a 4 character string, must be the sum of one of these 354,960 equations. Edited June 23, 2014 by maconvert
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now