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

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

Square prime gaps to 10000000000:
Square prime gaps to 10000000000:
Square difference 1: 1 found. Example: (2, 3).
Square difference 1: 1 found. Example: (2, 3).