Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.4K Views
|
9 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

How do I turn a huge number into a few bits?

Posted 6 years ago

Say I have the number 94728228010056348223853483453583434753322

I need to turn it into about 3 bytes of data.

I know it's possible because 9^9+1 = 387420490

My problem is how do I get the exact large number? I'm sure there's a mathematical rule to get the starting numbers needed to initiate it. As you can see above, I added a +1, to adjust the result further.

Maybe some sort of exponential greedy-wise.

POSTED BY: Steven Matthews
9 Replies

I made a simple modification to my code to test the method plus multiplication, just out of curiosity because the result of this example is still not “smaller” than the initial number in this case. Follows:

s = 2855754796332;
w = Flatten@
   ParallelTable[{If[Abs[q*m^n - s] < 1000000, {q, m, n}, {}], 
     If[Abs[q*m^n - s] < 1000000, (-1)*(q*m^n - s), {}]}, {m, 2, 
     3000}, {n, 2, 10}, {q, 1, 10000}] // AbsoluteTiming

im1

s = 193791;
w = Flatten@
   ParallelTable[{If[Abs[q*m^n - s] < 100, {q, m, n}, {}], 
     If[Abs[q*m^n - s] < 100, (-1)*(q*m^n - s), {}]}, {m, 2, 
     1000}, {n, 2, 15}, {q, 1, 1000}] // AbsoluteTiming

im2

Arriving at one of the results:

6231*771^3 + 757*2^8 - 1

im3

This was another attempt to represent the number in a smaller way, but I believe that some numbers are shorter if they are represented extensively and others in the form of operations, depends on the initial number. It may be that someone knows another code that creates an even smaller form of representation of large numbers....

POSTED BY: Claudio Chaib

Yes to the first question. It was just a test, where I took a number and turned it into exponent operations (with no multiplications between different numbers in that attempt). For some numbers this should be shorter and others should not change much. In the example: 10^7+47=10000047 it gets smaller (gets smaller but do not know much about less "bits "). I believe it depends a lot on the initial number... It is true that the number 2855754796332=1300^4-51^5-178417 (in this possible form) also did not get smaller, perhaps if slightly changing the method (adding multiplications to the method like "a.b^c+d.e^f+g" instead of only exponents “b^c+e^f+g” as I did..) or some other values in the code...don't know... After all it was just a try.

POSTED BY: Claudio Chaib

1300^4 - 51^5 - 3^11 - 6^4 + 5^2 + 1

output=2855754796332

So here, above, the output result is reached if the input is:

1300^4 - 51^5 - 3^11 - 6^4 + 5^2 + 1

?

Isn't that the same amount of bits anyway though? It takes as many in to get the output out, in the end of the story?

POSTED BY: Steven Matthews

I did some tests but I don't know if this will be useful to you.. I did with smaller numbers and with more than 3 “parts” as you would like, but it may be an idea...Example for a more obvious number: 10000047

s = 10000047;
w = Flatten@
  ParallelTable[{If[Abs[m^n - s] < 1000000, {m, n}, {}], 
    If[Abs[m^n - s] < 1000000, (-1)*(m^n - s), {}]}, {m, 2, 50}, {n, 
    2, 50}]; w

ima1

..then continuing successively in the first example:

s = 234422;
w = Flatten@
  ParallelTable[{If[Abs[m^n - s] < 1000, {m, n}, {}], 
    If[Abs[m^n - s] < 1000, (-1)*(m^n - s), {}]}, {m, 2, 50}, {n, 2, 
    50}]; w

ima2

..and so on for all values and regulating the numbers within the code until you get to the following table:

5^10 + 22^4 + 13^2 - 3
6^9 - 5^7 + 2^9 - 6^2
10^7 + 7^2 - 2
25^5 + 22^4 + 13^2 - 3

ima3

It is clear that this method does not cover all possibilities, but at least arrives at some result. It is susceptible to the values chosen within the code and the processing speed for larger numbers!

In the case of a larger and less obvious number for example: 2855754796332

s = 2855754796332;
w2 = Flatten@
  ParallelTable[{If[Abs[m^n - s] < 1000000000, {m, n}, {}], 
    If[Abs[m^n - s] < 1000000000, (-1)*(m^n - s), {}]}, {m, 2, 
    2000}, {n, 2, 2000}]; w2

ima4

...and doing the same procedure by modifying the code values until you simplify the result:

s = 345203668;
w3 = Flatten@
  ParallelTable[{If[Abs[m^n - s] < 1000000, {m, n}, {}], 
    If[Abs[m^n - s] < 1000000, (-1)*(m^n - s), {}]}, {m, 2, 400}, {n, 
    2, 400}]; w3

ima5

..and so it continues until it reaches the final result (at least the result I found):

1300^4 - 51^5 - 3^11 - 6^4 + 5^2 + 1

ima6

These were my tests but the numbers were not so big and the modifications to the code at every step were done manually. So, for much larger numbers this method would give a little more work.

There may be another method to do that, or even some way to have fewer terms, but I don't know..

Even if it's not exactly what you'd like, it might be of some use.

POSTED BY: Claudio Chaib

See above.

Also, here is some further tests to show slow increase in desired result:

9^8=43,046,721

9^8.1=53,624,632

9^8.2=66,801,863

9^8.3=83.217.148

9^8.4=103,666,176

9^8.5=129.140.163

8^9=134,217.728

9^9=387,420,489

And maybe we can do this to parts of the big number:

947 282280 100563 482238 53483 4535834 34753322

?

POSTED BY: Steven Matthews

Yes, I have a reason to believe it.

8^13=549755813888

And if I want to tweak the result:

8^13+8=549755813896

POSTED BY: Steven Matthews

Do you have a reason to believe there is a "small" representation of 94728228010056348223853483453583434753322 ? It strikes me as plausible that there may be no such.

By the way, 36^^whatever parses the alphanumerics in whatever as a number in base 36.

POSTED BY: Daniel Lichtblau

" "Maybe some sort of exponential greedy-wise" perhaps you have already read the algorithm and are waiting for others to respond knowing it for some reason? Yes there are many algorithms involving exponent number representation - the best are patented and on the Intel chip i assume. " No but go ahead, I'm waiting to hear another way. I'm still searching too... If 9^9=387420490 ( which it does ) and I want 397361144 then that is one step there, however it does leave a whopping 9940654 remaining. We must be doing it wrong...

What is: 36^^3973g9f3igvh4a6e3o60cz93y96 == 94728228010056348223853483453583434753322 ? How did you get that smaller number at left? And why is there 2 '^'?

POSTED BY: Steven Matthews
Anonymous User
Anonymous User
Posted 6 years ago
POSTED BY: Anonymous User
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard