• recategorized by
501 views
1 1 vote

Let us suppose we are given an integer $\text{N}$ in binary representation. Let us consider the following algorithm to check if $\text{N}$ is a prime.

  • For every $i$ such that $2 \leq i \leq\lceil\sqrt{\text{N}}\rceil$, check if $i$ divides $\text{N}$.
  • If any of the $i\text{'s}$ divides $\text{N},$ return that $\text{N}$ is not a prime.
  • Else, return that $i$ is a prime.

Based on this information, answer the following.

What is the order of magnitude of the running time in terms of the input size? (Assume hypothetically that division can be done in $\text{O}(1)$ time).

Please log in or register to answer this question.

Position:
Show:

Related questions

2 2 votes
3 3 answers
898
898 views
admin asked Dec 15, 2022
898 views
Compute $\left[M M^{T}\right]^{-1}$ for an orthogonal matrix where\[M=\left[\begin{array}{lll}\frac{1}{\sqrt{2}} & \frac{2}{\sqrt{2}} & \frac{-2}{\sqrt{2}} \\\frac{-2}{\s...
1 1 vote
1 1 answer
616
616 views
admin asked Dec 15, 2022
616 views
If the prefix traversal order of a tree is $*+\mathbf{a} \mathbf{b}-\mathbf{c} \mathbf{d}$. Then, find the equivalent postfix order of the that tree.
1 1 vote
1 1 answer
515
515 views
admin asked Dec 15, 2022
515 views
Total number of functions from set $B$ to set $A$ with $n$ and $m$ elements, respectively are ___________.
2 2 votes
2 2 answers
626
626 views
admin asked Dec 15, 2022
626 views
For decimal number $-30$, the $16$-bit $2$'s complement representation is _________