Anonymous user
Cuban primes: Difference between revisions
m
→{{header|Julia}}
m (→{{header|Maple}}: again, added an incorrect flag for not having the correct output. Please ensure the output for the 1st 200 cuban primes is correct.) |
|||
Line 777:
{{trans|Go}}
{{works with|Julia|1.2}}
<lang julia>using
function cubanprimes(N)
cubans = zeros(
cube100k, cube1, count = 0, 1, 1
j = BigInt(i + 1)
cube2 = j^3
diff = cube2 - cube1
if isprime(diff)
if count == 100000
cube100k = diff
Line 802 ⟶ 799:
println("The first $N cuban primes are: ")
foreach(x -> print(lpad(cubans[x] == 0 ? "" : cubans[x], 10), x % 8 == 0 ? "\n" : ""), 1:N)
println("\nThe 100,000th cuban prime is ",
end
|