Viết chương trình tính tổng và giải thích cách tìm công thức tổng quát của bài toán:
\(S=\sqrt{1+\sqrt{2+....+\sqrt{n-1+\sqrt{n}}}}\) vơi nhập từ bàn phím.
(*Kiến thức mới: SQRT(x) :\(\sqrt{x}\))
Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
Ta tính một vài giá trị đầu của Un:
\(U_1=3;U_2=7;U_3=15;U_4=35;U_5=83\)
Đặt \(U_{n+1}=aU_n+bU_{n-1}+c\) (*)
Khi đó thay lần lượt \(n=2,n=3,n=4\) vào (*), ta có:
\(\left\{{}\begin{matrix}15=7a+3b+c\\35=15a+7b+c\\83=35a+15b+c\end{matrix}\right.\) \(\Leftrightarrow\left\{{}\begin{matrix}a=2\\b=1\\c=-2\end{matrix}\right.\)
Do đó \(U_{n+1}=2U_n+U_{n-1}-2\)
\(u_2=\sqrt{2}\left(2+3\right)-3=5\sqrt{2}-3\)
\(u_3=\sqrt{\dfrac{3}{2}}.5\sqrt{2}-3=5\sqrt{3}-3\)
\(u_4=\sqrt{\dfrac{4}{3}}.5\sqrt{3}-3=5\sqrt{4}-3\)
....
\(\Rightarrow u_n=5\sqrt{n}-3\)
\(\Rightarrow\lim\limits\dfrac{u_n}{\sqrt{n}}=\lim\limits\dfrac{5\sqrt{n}-3}{\sqrt{n}}=5\)
Bài 1:
function canbac2(x:longint):real;
begin
canbac2:=sqrt(x);
end;
Bài 2:
function tong(n:longint):longint;
var s,i:longint;
begin
s:=0;
for i:=1 to n do
s:=s+i;
tong:=s;
end;
program tinhp;
uses crt;
var x,n,i: integer;
s: real;
begin
clrscr;
write('Nhap n:'); readln(n);
write('Nhap x:'); readln(x);
s:=sqrt(x);
for i:=1 to n do
s:= sqrt (x+s);
writeln('tong s=',s:6:2);
readln;
end.
program tinhp;
uses crt;
var x,n,i: integer;
s: real;
begin
write('Nhap n:');
readln(n);
write('Nhap x:');
readln(x);
s: sqrt(x);
for i:=1 to do s:= sqrt (x+s);
write('tong s=',s:6:2);
readln;
end.
uses crt;
var i,n,s:integer;
begin
clrscr;
readln(n);
s:=0;
for i:=1 to n do
s:=s+i*i;
writeln(s);
readln;
end.
\(A=\frac{1}{\sqrt{2001}+\sqrt{2003}}+\frac{1}{\sqrt{2003}+\sqrt{2005}}+...+\frac{1}{\sqrt{2015}+\sqrt{2017}}\)
Ta có công thức:
\(\frac{1}{\sqrt{n}+\sqrt{n+1}}=\frac{\sqrt{n+1}-\sqrt{n}}{\left(\sqrt{n}+\sqrt{n+1}\right)\left(\sqrt{n+1}-\sqrt{n}\right)}=\sqrt{n+1}-\sqrt{n}\)
Áp dụng vào công thức ta có:
\(A=\frac{1}{\sqrt{2001}+\sqrt{2003}}+\frac{1}{\sqrt{2003}+\sqrt{2005}}+...+\frac{1}{\sqrt{2015}+\sqrt{2017}}\)
\(A=\sqrt{2003}-\sqrt{2001}+\sqrt{2005}-\sqrt{2003}+...+\sqrt{2017}-\sqrt{2015}\)
\(A=\sqrt{2017}-\sqrt{2001}\approx0,17848\)
program Lam_Lui;
var S:extended;
i,n:integer;
begin
clrscr;
write('Nhap n = ');
readln(n);
S:=0;
for i:=n downto 1 do S:=sqrt(i+S);
write('Sai tự chịu: ',S);
readln;
end.
program Lam_Lui;
var S:extended;
i,n:integer;
begin
clrscr;
write('Nhap n = ');
readln(n);
S:=0;
for i:=n downto 1 do S:=sqrt(i+S);
writeln('Sai tự chịu: ',S);
readln;
end.