Post Reply 
Problem with a list in CAS-program
10-11-2017, 09:45 AM (This post was last modified: 10-11-2017 01:56 PM by Arno K.)
Post: #1
Problem with a list in CAS-program
Is something like l(K):=l(K)+1 forbidden in a CAS-program? The list seems to be killed when the program runs through this order:
Code:
#cas
POSDIVNF(n):=
BEGIN
LOCAL l,p,j,m;
l:= MAKELIST(1,X,1,n);
PRINT();
 FOR j FROM 2 TO n DO
  p:=1;
m:=j;
   WHILE p≤j DO
     p:=nextprime(p);
      WHILE irem(m,p)==0 DO
      m:=iquo(m,p);
K:=p;//only inserted K as I had to break down the error by hand, lack of debug
PRINT(K);
PRINT(SIZE(l));
l(K):=l(K)+1;
//PRINT(l);
      END;
   END;
 END;

  return ΠLIST(l);
END;
#end
the same code runs fine as program for home, the cas-program prints 2,8,3,3...
, notice the size of l: first 8 then 3, and returns: K->"Error:Invalid Dimension"
Arno
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Problem with a list in CAS-program - Arno K - 10-11-2017 09:45 AM
Problem with a list in CAS-program - Rudi - 10-29-2017, 04:55 PM



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