[Jprogramming] arithmetic sequence

alessandro codenotti code95 at live.it
Wed Dec 19 11:46:25 UTC 2012


I have a sequence defined as:

S(1)=K
S(n+1)=3+5*S(n)

where K is an integer constant
so the first 4 terms of this sequence (in function of K) are:
S(1)=K
S(2)=5K+3
S(3)=25K+18
s(4)=125K+93

representing every term with an array where the first element is the coefficent of K and the second is the other part is trivial to write the following verb to find the next term of the sequence:

   next=.0 3+*&5
   next 1 0
5 3
   next 5 3
25 18
   next 25 18
125 93

but i have a problem writing a functions that returns an array of shape equals to N 2 where the n-th row contain the 2 coefficents of the n-th term of the sequence, can anyone help me doing that?
Thank in advice!



 		 	   		  


More information about the Programming mailing list