Prime triangle: Difference between revisions
m
optimized slightly
m (optimized slightly) |
|||
Line 49:
counts, rowstrings = [1; zeros(Int, nrows - 1)], ["" for _ in 1:nrows]
@Threads.threads for r in shuffle(2:nrows)
p = zeros(Int, r - 1)
for e in permutations(2:2:r), o in permutations(3:2:r)
for (x, y) in zip(e, o)
p[i += 1] = y
end
length(e) > length(o) &&
if pmask[p[
if counts[r] == 0
rowstrings[r] = " 1" * prod([lpad(n, 3) for n in p]) * lpad(r + 1, 3) * "\n"
Line 87 ⟶ 89:
[1, 1, 1, 1, 1, 2, 4, 7, 24, 80, 216, 648, 1304, 3392, 13808, 59448]
</pre>
|