Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Prime Number Finder

by Roy Johnson (Monsignor)
on Nov 11, 2005 at 21:47 UTC ( #507875=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Prime Number Finder
in thread Prime Number Finder

some polynomial time in the number of bits.
If the number of bits is constant, then any polynomial time based on it is constant.

Caution: Contents may have been coded under pressure.


Comment on Re^3: Prime Number Finder
Re^4: Prime Number Finder
by blokhead (Monsignor) on Nov 11, 2005 at 22:58 UTC
    If the number of bits is constant, then any polynomial time based on it is constant.
    Big-O statements (like an algorithm taking constant or O(1) time) are statements about asymptotic behavior, i.e, how the function behaves in the limit (usually, as input size tends to infinity). If you don't look at them in the limit, then big-O-ish language (like constant time) is meaningless.

    How meaningless? Even undecidable languages have a constant time "algorithm" if you consider the input size to be held to a constant. So without viewing things in the limit, all problems become computationally equivalent in the asymptotic language.

    Update: added citation from parent node

    blokhead

      It is reasonable to assume that some inputs will vary from 1 to very large. I do not agree with you that it is reasonable to assume that input numbers will in this case. There will be some interesting size of number, and not much variation around it.

      Caution: Contents may have been coded under pressure.
        I really don't want to beat this thread into the ground, but...
        It is reasonable to assume that some inputs will vary from 1 to very large. I do not agree with you that it is reasonable to assume that input numbers will in this case. There will be some interesting size of number, and not much variation around it.
        My point is not that one must always consider input sizes from 1 to infinity. It's completely reasonable to only be interested in finding the most efficient algorithm for a specific range of input sizes. But you originally said that in such a case, the running time of a polynomial algorithm would be constant, as if it were a meaningful statement. With inputs restricted to a fixed interval, it is the case that (with very few exceptions) any function is big-O of any other function, so big-O language is meaningless. (Although you didn't explicitly mention big-O, it is implied when you say that the running time is "constant." If this isn't what you meant, then fine.)

        If one is really only interested in a specific range of inputs (which is fine), one should use actual running time numbers for comparison (which are comparable and therefore meaningful), not asymptotics (which are all equivalent when not being considered in the limit).

        blokhead

      You're right, blokhead. I came to conclusions too fast after reading Q::S documentation. I think the documentation is badly formulated about this point, too.

      Thanks for correcting.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://507875]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-07-25 23:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls