Skip to content

Instantly share code, notes, and snippets.

@originalsouth
Last active February 2, 2025 19:55
Show Gist options
  • Save originalsouth/26eb8841748926fd36dc0dfe6ee34c69 to your computer and use it in GitHub Desktop.
Save originalsouth/26eb8841748926fd36dc0dfe6ee34c69 to your computer and use it in GitHub Desktop.
Yet another belphegor's prime script
#!/usr/bin/env julia
using DataStructures
using Primes
using Statistics
belphegor(x::Integer) = parse(BigInt,(z -> "1$(z)666$(z)1")("0"^x))
buf = CircularBuffer{Float64}(100)
for i in 0:10^4
n = belphegor(i)
t = @elapsed test = isprime(n)
push!(buf, t)
if test
print(" "^32*"\r")
println(i)
else
print("$i (10^$(round(log10(mean(buf)); digits = 2))s)"*" "^8*"\r")
end
end
exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment