Programming Logic: Finding the smallest equation to a large number

前端 未结 8 1844
广开言路
广开言路 2021-01-03 00:51

I do not know a whole lot about math, so I don\'t know how to begin to google what I am looking for, so I rely on the intelligence of experts to help me understand what I am

相关标签:
8条回答
  • 2021-01-03 01:19

    While your question remains unclear, perhaps integer relation finding is what you are after.

    EDIT:

    There is some speculation that finding a "short" form is somehow related to the factoring problem. I don't believe that is true unless your definition requires a product as the answer. Consider the following pseudo-algorithm which is just sketch and for which no optimization is attempted.

    If "shortest" is a well-defined concept, then in general you get "short" expressions by using small integers to large powers. If N is my integer, then I can find an integer nearby that is 0 mod 4. How close? Within +/- 2. I can find an integer within +/- 4 that is 0 mod 8. And so on. Now that's just the powers of 2. I can perform the same exercise with 3, 5, 7, etc. We can, for example, easily find the nearest integer that is simultaneously the product of powers of 2, 3, 5, 7, 11, 13, and 17, call it N_1. Now compute N-N_1, call it d_1. Maybe d_1 is "short". If so, then N_1 (expressed as power of the prime) + d_1 is the answer. If not, recurse to find a "short" expression for d_1.

    We can also pick integers that are maybe farther away than our first choice; even though the difference d_1 is larger, it might have a shorter form.

    0 讨论(0)
  • 2021-01-03 01:19

    The existence of an infinite number of primes means that there will always be numbers that cannot be simplified by factoring. What you're asking for is not possible, sorry.

    0 讨论(0)
  • 2021-01-03 01:24

    It looks like you're basically wanting to do factoring on an arbitrarily large number. That is such a difficult problem that it actually serves as the cornerstone of modern-day cryptography.

    0 讨论(0)
  • 2021-01-03 01:27

    You're doing a form of lossless compression, and lossless compression doesn't work on random data. Suppose, to the contrary, that you had a way of compressing N-bit numbers into N-1-bit numbers. In that case, you'd have 2^N values to compress into 2^N-1 designations, which is an average of 2 values per designation, so your average designation couldn't be uncompressed. Lossless compression works well on relatively structured data, where data we're likely to get is compressed small, and data we aren't going to get actually grows some.

    It's a little more complicated than that, since you're compressing partly by allowing more information per character. (There are a greater number of N-character sequences involving digits and operators than digits alone.) Still, you're not going to get lossless compression that, on the average, is better than just writing the whole numbers in binary.

    0 讨论(0)
  • 2021-01-03 01:29

    I asked the question "what's the point of doing this", as I don't know if you're looking at this question from a mathemetics point of view, or a large number factoring point of view.

    As other answers have considered the factoring point of view, I'll look at the maths angle. In particular, the problem you are describing is a compressibility problem. This is where you have a number, and want to describe it in the smallest algorithm. Highly random numbers have very poor compressibility, as to describe them you either have to write out all of the digits, or describe a deterministic algorithm which is only slightly smaller than the number itself.

    There is currently no general mathemetical theorem which can determine if a representation of a number is the smallest possible for that number (although a lower bound can be discovered by understanding shannon's information theory). (I said general theorem, as special cases do exist).

    As you said you don't know a whole lot of math, this is perhaps not a useful answer for you...

    0 讨论(0)
  • 2021-01-03 01:37

    This really appears to be a mathematics problem, and not programming or computer science problem. You should ask this on https://math.stackexchange.com/

    0 讨论(0)
提交回复
热议问题