a = vector(10 000) os = Set([]) s = Set([]) nb = 0 try(z) = if (nb < #a, if (!set search(s, z) && !set search(os, z), s = set union(s, Set([z])); if (#s > 1000, os = set union(os, s); s = Set([])); nb++; a[nb] = z)) explore(z) = try(z*(1+I)); try((z-1)*(1+I)+1) try(0) for (i=1, #a, z = a[i]; print (i " " imag(z)); if (nb < #a, explore(z))) quit