Find adjacent primes which differ by a square integer: Difference between revisions

m
Line 201:
diffs = [pri[i] - pri[i - 1] for i in 2:length(pri)]
squarediffs = sort(unique(filter(n -> n in squares, diffs)))
println("\n\nSquare prime gaps to $limit:")
for sq in squarediffs
i = findfirst(x -> x == sq, diffs)
Line 235:
Showing all 2 with square difference 100:
(396733, 396833) (838249, 838349)
 
Square prime gaps to 10000000000:
Square difference 1: 1 found. Example: (2, 3).
4,102

edits