Cuban primes: Difference between revisions

m
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 Formatting, Primes
 
function cubanprimes(N)
cubans = zeros(BigIntInt, N)
cube100k, cube1, count = 0, 1, 1
cube1for =i BigIntin Iterators.countfrom(1)
count = 1
for i in 1:100000000
j = BigInt(i + 1)
cube2 = j^3
diff = cube2 - cube1
if isprime(diff)
ifcount ≤ N && (cubans[count] <= Ndiff)
cubans[count] = diff
end
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 ", format(cube100k, commas=true))
end