Correct and this is why I dislike the use of Big O in non-academic discourse because when people use Big O they usually really mean Big Theta, which is a tight bound and not an upper bound like Big O.
Ahem. Yes, it's true for integers which prints in O(log_b(n)).
But have you consider printing those in binary? O(1) for all fixed sized integer types (__int128 go brrrr). Is it slower than the integer printing? Maybe. Does it falls appart if you need more bytes? Maybe. Are you willing to make a template/macro which can unwrap a N sized loop to maintain O(1) for any arbitrary fixed size? I'll let you decide.
Big O just represents the upper bound, not the worst case. The best/avg/worst case each can have big/small O, theta and big/small omega assigned to them
Suppose there exists a memory storage device with infinite capacity and that the maximum speed of causality can be safely ignored because the device is extremely small. Also suppose that infinite time is available. Now assume all prime numbers have been calculated and stored on the memory storage device. Thus, an algorithm for calculating an n-th prime merely reduces to retrieval of data from the memory storage device, which has time complexity O(1).
The algorithm "wait a million years; answer 42" is O(1) but wouldn't be usable for anything. P=NP does not mean that there is a way to solve problems in NP fast.
It's been a while since I took algorithms, but I recall you can break down any NP problem to the simplest form and then if you could prove that could be solved in polynomial time, you'd be able to solve NP problems fast
There is a difference between computation theory and practical implementation. As I was trying to highlight, an polynomial algorithm does not mean that it is is fast. It just meant the complexity doesn't grow that fast.
The implications of P=NP are currently unknown. It could be that all NP problems are NP fast. It could be we have to compute infinitely. It could be just walking a tree to the answer. It depends on if P=NP, and what type of solution we find. You are talking in certain terms, but in my opinion, probably shouldnt be.
It also depends on the type of proof. Maybe someone shows that P≠NP can't be true (not likely but could be). That would solve the problem but doesn't give an algorithm.
An algorithm that has a time complexity of Θ(n^1000) is technically still in P, yet still impractically slow (probably slower than most NP-hard algorithms on realistic input sizes). Being in P doesnt mean the algorithm is practically fast. Just that their time complexity is some polynomial instead of the exponential time complexity of NP complete problems.
Yeah, but just because its considered asymptotically fast does not necessarily mean it's actually fast to execute.
An example is integer multiplication. The asymptotically fastest known algorithm is O(n log n) but the hidden constant is so big that it only becomes faster for integers with trillions of digits.
And of course a Θ(ngoogol ) algorithm would also be considered fast because it's still polynomial but it would not be practical
NP problems are often a family of problems where if you solve one, you solve them all. The same algorithmic solution can be applied across a huge range of disciplines. In the past, we have solved such problems where the solution is literally trivial. For example, computing some digit of pi or checking subsets of prime numbers.
Instead of calculating permutations we are essentially able to walk to the answer directly.
That would make things completely calculatable in essentially arbitrary time frames.
You are assuming its impossible, but id disagree.
Imagine the traveling salesman problem, where we make a tree of all possible states of that problem.
Right now, iterating the permutations and checking each possibility makes it computationally prohibitive & expensive.
However, there might be a solution to the problem such that you can walk down the tree of possibilities directly to the answer. This would be a solution such that P=NP, and you do not need permutation at all.
If you solved that problem, you can apply that same solution to literally tens of thousands of adjacent math and computer science problems.
We do not currently have that solution, and it is unclear if it will be something as easy as walking the tree, or using permutations which are incalculable.
The implications of this question remains to be seen. We will know if we ever get an answer.
I'm not assuming anything. I simply stated that just because something can be solved in polynomial time it doesn't necessarily mean that it's practical to solve, not that it can't be.
Just need a million processing units to each wait a year!
Yes your point is true, but the concern is when n gets large, and we deal with very large n these days. It only gets larger, as computers get faster.
My understanding is that quantum-proof algorithms still rely on P!=NP, since that's a fundamental need. As n keeps growing, it needs to always be true that it's faster to verify than to solve, and that's only the case if P!=NP.
Fortunately we can be pretty sure they didn't solve it, because the rumours are widespread enough that a claim wouldn't do any damage, and these companies love to make claims that are unproven. Plus it's easy enough to prove, it's not like they don't have the computing power to solve it.
432
u/IHeartBadCode 3d ago
Before you know it, they'll have O(1) time method for factoring all even primes.
55
u/djonoy 3d ago •
ERROR: expected comparison but found expression instead
106
u/seba07 2d ago
The algorithm "wait a million years; answer 42" is O(1) but wouldn't be usable for anything. P=NP does not mean that there is a way to solve problems in NP fast.
30
u/AkrinorNoname 1d ago
P=NP only for N=1 or P=0. No idea why everyone is so worked up about this.
14
u/Alzusand 2d ago
Please let it be true it would be so funny.
28
u/Front_Committee4993 3d ago
Let N=1
4
u/Substantial_Top5312 2d ago
n=1 or p = 0
3
u/Benjam438 1d ago
If P=NP I'm skeptical of the letter N
2
u/Wiseon321 1d ago
I refuse to believe this thought experiment is even important.
1
u/username_6916 2d ago
Show all your work for full credit.