in Others edited by
80 views
0 votes
0 votes

Consider the following algorithm that takes as input a positive integer $n$.

if (n == 1) {
return "Neither prime nor composite."
}
m=2
while (m < n) {
if (m divides n ){
return "Composite."
}
m=m+1
}
return "Prime."


If $n$ is a number of the form $n=p^{2} q^{3} r^{4}$ where $p, q, r$ are natural numbers greater than 1 , how many times does the while loop in the algorithm run?
In the options below, for any real number $m,\lceil m\rceil$ denotes the least integer greater than or equal to $m$.

  1. The while loop runs at most $\left\lceil n^{1 / 9}\right\rceil$ times for all natural numbers $p, q, r$ greater than one.
  2. The while loop runs at most $\left\lceil n^{1 / 9}\right\rceil$ times only if $p, q, r$ are all distinct.
  3. The while loop runs at most $\left\lceil n^{1 / 9}\right\rceil$ times only if at least two of $p, q, r$ are distinct.
  4. The while loop runs at most $\left\lceil n^{1 / 9}\right\rceil$ times only if $p, q, r$ are distinct primes.
  5. The while loop runs at most $\left\lceil n^{1 / 9}\right\rceil$ times only if $p, q, r$ are distinct primes or distinct prime powers.

     

in Others edited by
by
80 views

Please log in or register to answer this question.

Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true