Fractran: Difference between revisions
m
→{{header|Julia}}
Line 2,555:
=={{header|Julia}}==
{{works with|Julia|1.9}}<syntaxhighlight lang="julia">
# FRACTRAN interpreter implemented
struct Fractran
fracs::Vector{Rational{BigInt}}
maxout::Int
end
Line 2,575 ⟶ 2,574:
function Base.show(io::IO, ft::Fractran)
join(io, Iterators.take(eval(ft), ft.
end
macro code_str(s)
end
# Example FRACTRAN program generating primes
primes =
77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1", 2, 40)
# Output
println("First 25 iterations of FRACTRAN program 'primes':\n2 ",
println("
▲ join(Iterators.take(primes, 30), ' '), "\n")
primes</syntaxhighlight>
{{output}}
<pre>First
2 15 825 725 1925 2275 425 390 330 290 770 910 170 156 132 116 308 364 68 4 30 225 12375 10875 28875 25375
Watch the first
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
</pre>
=={{header|Kotlin}}==
|