using Primes, BenchmarkTools
@btime begin
lub = 1_000_000
ps = primes(lub)
maxaccum, maxconse = (zero(Int), zero(Int))
for i in 1:length(ps)-1
prsum = ps[i]
for j in i+1:length(ps)
prsum += ps[j]
prsum > lub && break
if isprime(prsum) && prsum > maxaccum && j-i+1 > maxconse
maxaccum, maxconse = (prsum, j-i+1)
end
end
end
maxaccum, maxconse
end
> 48.563 ms (94302 allocations: 2.29 MiB)
> (997651, 543)