Hi :) I'm doing a programming project with development of an algorithm for a quadratic recursive sequence: (3, 3, 7, 11, 19, 20, 32), but I can't figure out which expression to use. I know it's probably got something to do with the differences of n-1 and n-2 being added together. Any help you can offer would be appreciated. Thank you :)

4
Contributors
6
Replies
7
Views
9 Years
Discussion Span
Last Post by Lerner

Well this is nothing but an arithematic progression.

Well the first element is 3 and the second element is ((3x1)+0)=3 again the next element is ((3x2)+1)=7 and so on.

So you will just need to take in the first element as a ;

Then to get the first element multiply.......

To be apt here is the sequence.

``````int recrusive(int a,int b)
{
int x=(a*b)+(b-1);
return x;
}``````

I guess thats the function .

In main

``````int main()
{
int startval=3;
int total=startval;
{
total+=recrusive(startval,y)
}
cout<<"Total=="<<total;
}``````

Would print out the sum of the sequence.

EDIT::Hoping that this is what you want.Coz if you knew it already and havin some other prob, I am sorry

That code yields:

3, 7 , 11, 15, 19, 23, 27, 31 ...

I think you're on the right track though.

I'm trying to figure this one out too.

Well this is nothing but an arithematic progression.

Well the first element is 3 and the second element is ((3x1)+0)=3 again the next element is ((3x2)+1)=7 and so on.

So you will just need to take in the first element as a ;

Then to get the first element multiply.......

To be apt here is the sequence.

``````int recrusive(int a,int b)
{
int x=(a*b)+(b-1);
return x;
}``````

I guess thats the function .

In main

``````int main()
{
int startval=3;
int total=startval;
{
total+=recrusive(startval,y)
}
cout<<"Total=="<<total;
}``````

Would print out the sum of the sequence.

EDIT::Hoping that this is what you want.Coz if you knew it already and havin some other prob, I am sorry

Well i just realised that the function that i have written isnt recruisive at all. Sorry.

Not only that, I am also unable to figure out what a quadratic recursive sequence is..

Thank you for your help. I found an expression, but it utilizes defining the two threes as n(sub)1 = 3 and n(sub)2 = 3 at the beginning of the expression. I'm not sure that's allowed as an answer :) It's quite a brain tickler, I know!

So what's the definition of a "quadratic recursive sequence"?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.