Cho dãy: 0, 11, 28, 51, 79, 115, 156, 203,... Tìm số hạng thứ N.
Công thức
Dãy tăng parabolic: T_N = 3*N^2 + 2*N - 5.
Mã nguồn C++
#include <iostream>
using namespace std;
int findNTerm(int N) {
return 3*N*N + 2*N - 5;
}
int main() {
int N = 9;
cout << N << "th term of the series is " << findNTerm(N);
return 0;
}
Đầu ra
9th term of the series is 256