Fractran: Difference between revisions
Content added Content deleted
mNo edit summary |
|||
Line 1,866:
=={{header|Julia}}==
{{works with|Julia|0.6}}
<lang julia>function fractran(n::Integer,
for i in 1:
if (pos = findfirst(
n *=
else
break
end
end
end
using IterTools
macro ratio_str(s)
a =
end
77 / 19, 1 / 17, 11 / 13, 13 / 11, 15 / 14, 15 / 2, 55 / 1"""
▲println("The first 20 in the series are ", fractran(2, fracts, 20))
n =
while
if isinteger(log2(n))
println("Prime $
end
n = fractran(n,
end</lang>
{{output}}
<pre>The first 20 in the series are BigInt[2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290, 770, 910, 170, 156, 132, 116, 308, 364, 68, 4]▼
▲The first 20 in the series are BigInt[2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290, 770, 910, 170, 156, 132, 116, 308, 364, 68, 4]
Prime 1 found: 2 is 2 ^ 1
Prime 2 found: 4 is 2 ^ 2
Line 1,923 ⟶ 1,921:
Prime 18 found: 576460752303423488 is 2 ^ 59
Prime 19 found: 2305843009213693952 is 2 ^ 61
Prime 20 found: 147573952589676412928 is 2 ^ 67</pre>
=={{header|Kotlin}}==
|