Este URGENT, va rog
Să se calculeze primii 100 de termeni naturali utilizând structura de control al fluxului while și termenul general: x(indice n)=2ln(x(indice n−1))+x (indice 1 la patrat). Știind că primul termen din șir este egal cu 2, să se introducă valoarea termenului de pe poziția 25.
Imi trebuie termenul 25, valoarea sa
Răspunsuri la întrebare
#include <iostream>
#include <cmath>
using namespace std;
int main(){
double x[101];
int i;
x[1] = 2;
for(i=2;i<=100;i++)
x[i] = 2*log(x[i-1]) + pow(x[1],2);
for(i=1;i<=100;i++)
cout << i << " -> " << x[i] << endl;
}
==================================
Termenii in ordine pana la 100 :
1 -> 2
2 -> 5.38629
3 -> 7.36772
4 -> 7.99422
5 -> 8.15744
6 -> 8.19786
7 -> 8.20775
8 -> 8.21016
9 -> 8.21074
10 -> 8.21089
11 -> 8.21092
12 -> 8.21093
13 -> 8.21093
14 -> 8.21093
15 -> 8.21093
16 -> 8.21093
17 -> 8.21093
18 -> 8.21093
19 -> 8.21093
20 -> 8.21093
21 -> 8.21093
22 -> 8.21093
23 -> 8.21093
24 -> 8.21093
25 -> 8.21093
26 -> 8.21093
27 -> 8.21093
28 -> 8.21093
29 -> 8.21093
30 -> 8.21093
31 -> 8.21093
32 -> 8.21093
33 -> 8.21093
34 -> 8.21093
35 -> 8.21093
36 -> 8.21093
37 -> 8.21093
38 -> 8.21093
39 -> 8.21093
40 -> 8.21093
41 -> 8.21093
42 -> 8.21093
43 -> 8.21093
44 -> 8.21093
45 -> 8.21093
46 -> 8.21093
47 -> 8.21093
48 -> 8.21093
49 -> 8.21093
50 -> 8.21093
51 -> 8.21093
52 -> 8.21093
53 -> 8.21093
54 -> 8.21093
55 -> 8.21093
56 -> 8.21093
57 -> 8.21093
58 -> 8.21093
59 -> 8.21093
60 -> 8.21093
61 -> 8.21093
62 -> 8.21093
63 -> 8.21093
64 -> 8.21093
65 -> 8.21093
66 -> 8.21093
67 -> 8.21093
68 -> 8.21093
69 -> 8.21093
70 -> 8.21093
71 -> 8.21093
72 -> 8.21093
73 -> 8.21093
74 -> 8.21093
75 -> 8.21093
76 -> 8.21093
77 -> 8.21093
78 -> 8.21093
79 -> 8.21093
80 -> 8.21093
81 -> 8.21093
82 -> 8.21093
83 -> 8.21093
84 -> 8.21093
85 -> 8.21093
86 -> 8.21093
87 -> 8.21093
88 -> 8.21093
89 -> 8.21093
90 -> 8.21093
91 -> 8.21093
92 -> 8.21093
93 -> 8.21093
94 -> 8.21093
95 -> 8.21093
96 -> 8.21093
97 -> 8.21093
98 -> 8.21093
99 -> 8.21093
100 -> 8.21093
Ceea ce e putin dubios. Sigur asa era formula ?