Sum of two adjacent numbers are primes: Difference between revisions
Sum of two adjacent numbers are primes (view source)
Revision as of 18:58, 23 January 2022
, 2 years ago→{{header|Julia}}
Line 139:
using Primes
for n in take(20,
println("$n + $(n + 1) = $(n + n + 1)")
end
let
i, cnt = 0, 0
while cnt < 10_000_000
i += 1
if isprime(2i + 1)
cnt += 1
end
end
println("Ten millionth: $i + $(i + 1) = $(i + i + 1)")
end
</lang>{{out}}
Line 165 ⟶ 176:
35 + 36 = 71
36 + 37 = 73
Ten millionth: 89712345 + 89712346 = 179424691
</pre>
|