procedure sunmod(x) local base, bound, i, lseq, k x := copy(spromote(x)) base := 0 bound := sbound ! x lseq := [get(x)] | return [] while i := get(x) do { if (i = 1) & (lseq[Ð1] = base + bound) then base +:= bound else if (i = bound) & (lseq[-1] = base + 1) then base -:= bound put(lseq, base + i) } k := (smin ! lseq) if k > 0 then return lseq k := bound * (-k / bound + 1) every !lseq +:= k return lseq end