fun vanEck ← void by int firstIndex, int lastIndex logic isFirst ← true Map map ← int%int[] int last ← 0 write("[") if firstIndex æ 1 write("0") isFirst ← false end for int n ← 2 ; n ≤ lastIndex ; ++n int v ← when(map.has(last), n - map[last], 0) map[last] ← n last ← v if n ≥ firstIndex write(when(isFirst, Text.EMPTY, ",") + v) isFirst ← false end end writeLine("]") end Pair[int%int(1 ⇒ 10), int%int(991 ⇒ 1000)].list( void by var pair writeLine("Terms " + pair.key + " to " + pair.value + " of the sequence are:") vanEck(pair.key, pair.value) writeLine() end)