I've been trying to run Macaulay2 in Sage to generate some examples for a project I have.

I used cloud.sagemath.com and everything worked fine for a while, but some inputs just wouldn't evaluate. There was no error, and it wouldn't freeze- it's just that nothing would happen. I figured there was a calculation limit, so I downloaded sage and Macaulay2, but the same problem occurs. Sage and Macaulay2 appear to be properly installed.

An example of code which doesn't do anything is:

R=ZZ[O1,O2,O3,O4,O5,In1,In2,In3,In4,In5];

I= ideal (O1*O2,O2*O3,O3*O4,O4*O5,O5*O1,In1*In3,In3*In5,In5*In2,In2*In4,In4*In1,O1*In1,O2*In2,O3*In3,O4*In4,O5*In5);

J= ideal (O1,O2,O3,O4,O5,In1,In2,In3,In4,In5);

v= flatten entries mingens J;

e=flatten entries mingens I;

m=table(e,e,(a,b)->a*b);

s= unique flatten m;

for i when i<length e="" do="" s="delete(e#i^2,s);</p">

dvds = (a,b) -> if b%(a*a)==0 then true else false;

f = x -> any(v, a -> dvds(a,x));

i=0; while i<#s do if f(s#i)==false then s=delete(s#i,s) else i=i+1;

F= ideal (s);

betti F

betti I

Meanwhile, similar code which returns correct-looking output is

%macaulay2

R=ZZ[x1,x2,x3,x4];

I= ideal (x1*x2, x2*x3, x3*x4, x4*x1);

J= ideal (x1,x2,x3,x4);

v= flatten entries mingens J;

e=flatten entries mingens I;

m=table(e,e,(a,b)->a*b);

s= unique flatten m;

for i when i<length e="" do="" s="delete(e#i^2,s);</p">

dvds = (a,b) -> if b%(a*a)==0 then true else false;

f = x -> any(v, a -> dvds(a,x));

i=0; while i<#s do if f(s#i)==false then s=delete(s#i,s) else i=i+1;

```
s
```

F= ideal (s);

betti F

betti I

The output is Ideal of R

Ideal of R

```
2 2 2 2
```

{x1*x3*x4 , x2*x3 x4, x1 x2*x4, x1*x2 x3}

List

Ideal of R

```
0 1
```

total: 1 4 0: 1 . 1: . . 2: . . 3: . 4

BettiTally

```
0 1
```

total: 1 4 0: 1 . 1: . 4

BettiTally

The only real difference seems to be the number of calculations made, and this idea is confirmed in that the calculations always seem to fail around ZZ[x1..xn] for n>8. There must be some way to fix this. Can anyone help?