import sequtils,strutils,strscans,algorithm,math,future,sets,queues,tables,macros macro unpack*(rhs: seq,cnt: static[int]): auto = let t = genSym(); result = quote do:(let `t` = `rhs`;()) for i in 0.. 9: result = hash(result) # hash は 0,3,6,9にならない (3は一度だけ) => 124578の6が最大だが、大きい方を優先するので途中でbreakはできない let K = get().parseInt N = get().parseInt primes = getPrimes(N,start=K) var L = 0 hashes : set[int8] = {} ans = (prime:0, card:0) for i,p in primes: let h = hash(p) if h in hashes: while h in hashes: hashes -= hash(primes[L]) L += 1 hashes += h if hashes.card >= ans.card: ans.prime = primes[L] ans.card = hashes.card echo ans.prime