# analysis of algoritm

P1. Write down a computer program to compute the values of the following group of functions:

a)   f(n)=lg100 (n)          b)         f(n)=20*n3      c)f(n)=lglglg(n)=lg(3) (n)
g(n)=n0.05                       g(n)=(1.01) n              g(n)=lg* (n))

Note that, the domain of f(n) and g(n) are positive natural numbers; n=1,2,3,… . You will compute and display the values f(n) and g(n); and your program will terminate when one of the functions becomes greater than the other for five consecutive n values.

i dont understand what he means at the last sentence. " when one of the functions becomes greater than the other for five consecutive n values."

can anybody help me to understand the problem ?
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
I believe it means this:
one of those functions returns a value that is greater than the other five for a certain n. When that same function returns a value that is greater than the other five for n+1, n+2, n+3 and n+4, the program should terminate.

HTH,
Ruud
0
Author Commented:
can you explain more,
if its possible can you write the  if statment for this condition
0
Commented:
Made a typo in my first post: 'other five' should be just 'other'.

You start at n = 1, Then you go n = n + 1. Sooner or later you'll have 5 n's in a row (e.g. 6,7,8,9,10 or 40,41,42,43,44) where f(n) is greater than g(n). Or 5 n's where g(n) is greater than f(n).

Good luck writing that program. Is it homework?

0
Author Commented:
yes lab. homework

i write small program,

int main( int argc, char *argv[]){

int i = 1;

/* Preliminary 1 - a */
printf("Preliminary 1\n");

while( i <= 20 ){
printf("%d\n",i);
printf("a-) %.2f %.2f\n",pow(log10(i),100),pow(i,0.05));
printf("b-) %.2f %.2f\n",20*pow(i,3),pow(1.01,i));
printf("c-) %.2f %.2f\n",pow(log10(i),3),log(i));

printf("\n");
i+=1;
}

return 0;
}

from the output can you explain which value is satisfy

Preliminary 1
a-) 0.00 1.00
b-) 20.00 1.01
c-) 0.00 0.00

a-) 0.00 1.04
b-) 160.00 1.02
c-) 0.03 0.69

a-) 0.00 1.06
b-) 540.00 1.03
c-) 0.11 1.10

a-) 0.00 1.07
b-) 1280.00 1.04
c-) 0.22 1.39

a-) 0.00 1.08
b-) 2500.00 1.05
c-) 0.34 1.61

a-) 0.00 1.09
b-) 4320.00 1.06
c-) 0.47 1.79

a-) 0.00 1.10
b-) 6860.00 1.07
c-) 0.60 1.95

a-) 0.00 1.11
b-) 10240.00 1.08
c-) 0.74 2.08

a-) 0.01 1.12
b-) 14580.00 1.09
c-) 0.87 2.20

a-) 1.00 1.12
b-) 20000.00 1.10
c-) 1.00 2.30

a-) 57.74 1.13
b-) 26620.00 1.12
c-) 1.13 2.40

a-) 2039.10 1.13
b-) 34560.00 1.13
c-) 1.26 2.48

a-) 48563.57 1.14
b-) 43940.00 1.14
c-) 1.38 2.56

a-) 838134.28 1.14
b-) 54880.00 1.15
c-) 1.51 2.64

a-) 11068842.87 1.14
b-) 67500.00 1.16
c-) 1.63 2.71

a-) 116674612.55 1.15
b-) 81920.00 1.17
c-) 1.75 2.77

a-) 1014749836.62 1.15
b-) 98260.00 1.18
c-) 1.86 2.83

a-) 7478278499.90 1.16
b-) 116640.00 1.20
c-) 1.98 2.89

a-) 47718520380.19 1.16
b-) 137180.00 1.21
c-) 2.09 2.94

a-) 268368134667.23 1.16
b-) 160000.00 1.22
c-) 2.20 3.00

(20 iteration)
0
Commented:
> from the output can you explain which value is satisfy
Can you?

If you cannot tell whether the output is correct or not, my guess is you don't fully understand the question yet.
Just say so. I'll be happy to try another explanation.

0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.