Predrag Terzic on Tue, 28 Jan 2020 12:31:57 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Not a function in function call |
The following code works fine inside Sage Math Cell:
n=22;
compositorial(n)={c=1;l=[];forcomposite(i=1,n,c=c*i;l=concat(l,[nextprime(c+2)-c]));return(l);}
print(compositorial(n));
You can run this code
here.
But, this one doesn't :
n=22;
prevprime(k)={p=1;while(p<k,r=p;p=nextprime(p+1));return(r);}
compositorial(n)={c=10;l=[];forcomposite(i=1,n,c=c*i;l=concat(l,[c-prevprime(c-1)]));return(l);}
print(compositorial(n));
You can run this code
here.
I am getting the following message:
PARI/GP interpreter crashed -- automatically restarting. *** at top-level: print(compositorial(n)) *** ^----------------- *** not a function in function call
How to fix this problem?
|