Find adjacent primes which differ by a square integer: Difference between revisions
Content added Content deleted
Line 208: | Line 208: | ||
println("Showing all $n with square difference $sq:") |
println("Showing all $n with square difference $sq:") |
||
pairs = [(pri[i], pri[i + 1]) for i in findall(x -> x == sq, diffs)] |
pairs = [(pri[i], pri[i + 1]) for i in findall(x -> x == sq, diffs)] |
||
foreach(p -> print(last(p), first(p) % 4 == 0 ? "\n" : ""), enumerate(pairs)) |
foreach(p -> print(last(p), first(p) % 4 == 0 ? "\n" : " "), enumerate(pairs)) |
||
else |
else |
||
println("Square difference $sq: $n found. Example: ($(pri[i]), $(pri[i + 1])).") |
println("Square difference $sq: $n found. Example: ($(pri[i]), $(pri[i + 1])).") |
||
Line 223: | Line 223: | ||
Square prime gaps to 1000000: |
Square prime gaps to 1000000: |
||
Square difference 1: 1 found. Example: (2, 3). |
Square difference 1: 1 found. Example: (2, 3). |
||
Square difference 4: 8143 found. Example: (7, 11). |
Square difference 4: 8143 found. Example: (7, 11). |
||
Square difference 16: 2881 found. Example: (1831, 1847). |
Square difference 16: 2881 found. Example: (1831, 1847). |
||
Square difference 36: 767 found. Example: (9551, 9587). |
Square difference 36: 767 found. Example: (9551, 9587). |
||
Showing all 24 with square difference 64: |
Showing all 24 with square difference 64: |
||
(89689, 89753)(107377, 107441)(288583, 288647)(367957, 368021) |
(89689, 89753) (107377, 107441) (288583, 288647) (367957, 368021) |
||
(381103, 381167)(400759, 400823)(445363, 445427)(623107, 623171) |
(381103, 381167) (400759, 400823) (445363, 445427) (623107, 623171) |
||
(625699, 625763)(637003, 637067)(710713, 710777)(725209, 725273) |
(625699, 625763) (637003, 637067) (710713, 710777) (725209, 725273) |
||
(779413, 779477)(801883, 801947)(803749, 803813)(821677, 821741) |
(779413, 779477) (801883, 801947) (803749, 803813) (821677, 821741) |
||
(832519, 832583)(844777, 844841)(883807, 883871)(912103, 912167) |
(832519, 832583) (844777, 844841) (883807, 883871) (912103, 912167) |
||
(919447, 919511)(954763, 954827)(981823, 981887)(997813, 997877) |
(919447, 919511) (954763, 954827) (981823, 981887) (997813, 997877) |
||
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). |