Answer:
// program in C++.
#include <bits/stdc++.h>
using namespace std;
// function to fint the nth term of the series
long long int f(int n) {
// base case
if (n <= 1)
// return
return 1;
else
// recursive call
return pow(f(n - 1), 2) + 1;
}
// main function
int main()
{
// variable
int term;
cout<<"Enter the number of terms:";
// read the number of term of series
cin>>term;
// print the series
for(int i=1;i<=term;i++)
{
// call the function
cout<<f(i)<<" ";
}
return 0;
}
Step-by-step explanation:
Read the number of terms from user and assign it to variable "term".Call the function f() to find the term of the series.Find the nth term of the series as ""(n-1)th ^2 +1" with function f() and print it within the for loop.
Output:
Enter the number of terms:6
1 2 5 26 677 458330