Post Reply 
Recursive sequences in CAS on prime.
06-19-2015, 04:37 PM
Post: #6
RE: Recursive sequences in CAS on prime.
I managed to declare the sequence directly in CAS:

Code:
u:=(n)->CASE IF (n==1) THEN 3/2 END IF (n==2) THEN 5/3 END IF n>2 THEN 2003-6002/u(n-1)+4000/(u(n-1)*u(n-2)) END END

It works fine until n>10. After this, the recursion is too deep.

I made a CAS program too with a FOR loop :
Code:

#cas
u(n):=
BEGIN
LOCAL r,r1,r2
CASE
IF n==1 THEN RETURN 3/2; END;
IF n==2 THEN RETURN 5/3; END;
DEFAULT
r1=3/2
r2=5/3
FOR I FROM 3 TO n DO
r := 2003-6002/r2+4000/(r1*r2);
r1:=r2;
r2:=r;
END;

RETURN r;
END;
#end

But after all this, I think my favorite method is to use the spreadsheet with cells in CAS mode. It is fast and quite easy.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Recursive sequences in CAS on prime. - wawa - 06-19-2015 04:37 PM



User(s) browsing this thread: 1 Guest(s)