recategorized by
247 views
1 votes
1 votes

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).

recategorized by

Please log in or register to answer this question.

Related questions

483
views
1 answers
1 votes
admin asked Dec 15, 2022
483 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 ... sqrt{2}} & \frac{1}{\sqrt{2}} & \frac{2}{\sqrt{2}}\end{array}\right] .\]
286
views
0 answers
1 votes
admin asked Dec 15, 2022
286 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.
259
views
0 answers
1 votes
admin asked Dec 15, 2022
259 views
Total number of functions from set $B$ to set $A$ with $n$ and $m$ elements, respectively are ___________.
323
views
1 answers
1 votes
admin asked Dec 15, 2022
323 views
For decimal number $-30$, the $16$-bit $2$'s complement representation is _________