Off by one in rationalizing a square root problem

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
8 replies · 3K views
rajatgl16
Messages
54
Reaction score
0
in the ques that i have attached as image with this thread..
I did it as an can be solved to [tex]\sqrt{}n[/tex] by rationalising it.

So as squre root of every natural no. 'n' is smaller than squre root of 'n+1' then in this ques. possible values comes out to be zero. Am i Right?
 

Attachments

  • scan0007-crop.jpg
    scan0007-crop.jpg
    21.4 KB · Views: 551
Physics news on Phys.org
hi rajatgl16! :smile:

(have a square-root: √ :wink:)

hint: try an for n = 100 up to 121 :smile:
 
I;m not getting what you mean. Please elaborate
 
Check for which n from 100..121 range an > an+1.

Do the same for any other range bounded by k2 and (k+1)2.

Look if there is some pattern.

If there is no pattern, I have no idea what tiny-tim aims at.
 
#include <stdio.h>
#include <math.h>
#define MAX 2010

int gint(float x)
{
int n;
n=x;
return n;
}

int main()
{
int a[MAX], j,k, i, count1=0;
for(i=1; i<=MAX; i++){
k=gint(sqrt(i));
a=gint(i/k);
if(a[i-1]>a){
count1++;
printf("a(%d)=%d > a(%d)=%d\n", i-1,a[i-1], i, a);
}
else continue;
}
printf("%d", count1-1);}answer comes out to be 42
 
rajatgl16 said:
in the ques that i have attached as image with this thread..
I did it as an can be solved to [tex]\sqrt{n}[/tex] by rationalising it.

So as squre root of every natural no. 'n' is smaller than squre root of 'n+1' then in this ques. possible values comes out to be zero. Am i Right?

I'm thinking that [itex]a_n > a_{n+1} \forall (n+1)^2 \in \mathbb{Z}[/itex].

There are [itex]\left\lfloor\sqrt{2010}\right\rfloor = 44[/itex] perfect squares less than 2010, so I get 43 different values for n such that an > an+1.
 
Mandelbroth said:
I'm thinking that [itex]a_n > a_{n+1} \forall (n+1)^2 \in \mathbb{Z}[/itex].

There are [itex]\left\lfloor\sqrt{2010}\right\rfloor = 44[/itex] perfect squares less than 2010, so I get 43 different values for n such that an > an+1.
Do you realize that you've just responded to a pretty old thread ?
 
SammyS said:
Do you realize that you've just responded to a pretty old thread ?
Yes, I noticed. I'd like to know why I'm off by one from naveeniitkgp's answer, so I decided to respond here rather than make a new thread linking back to this one.

Is that bad? If so, I apologize...
 
Mandelbroth said:
Yes, I noticed. I'd like to know why I'm off by one from naveeniitkgp's answer, so I decided to respond here rather than make a new thread linking back to this one.

Is that bad? If so, I apologize...
No. That's not necessarily bad.

Your answer is correct.