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.
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.
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.
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.
270
u/IHeartBadCode 1d ago
Before you know it, they'll have O(1) time method for factoring all even primes.
44
u/djonoy 1d ago •
ERROR: expected comparison but found expression instead
62
u/seba07 1d 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.
28
u/Front_Committee4993 1d ago
Let N=1
11
u/Alzusand 1d ago
Please let it be true it would be so funny.
3
u/Substantial_Top5312 1d ago
n=1 or p = 0
1
u/Wiseon321 8h ago
I refuse to believe this thought experiment is even important.
1
u/Benjam438 7h ago
If P=NP I'm skeptical of the letter N
1
u/AkrinorNoname 1h ago
P=NP only for N=1 or P=0. No idea why everyone is so worked up about this.
0
u/username_6916 1d ago
Show all your work for full credit.