Problem with a list in CAS-program
|
10-29-2017, 04:55 PM
Post: #15
|
|||
|
|||
Problem with a list in CAS-program
This may generate an error because you want to add a single item to a list, which will correctly result in an error. I think it's better to address the next element of the list with l (K + 1). I am missing the assignment of the value to the list l (k + 1).
The program works now. But the algorithm must still be adjusted. I did not check it. Best regards, Rudi Code: #cas POSDIVNF(n):= BEGIN LOCAL l,p,j,m,k0; 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); l:=append(l,p+1); END; END; END; return ΠLIST(l); END; #end |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)