Engel expansion: Difference between revisions

m
m (syntax highlighting fixup automation)
Line 95:
 
=={{header|Julia}}==
<syntaxhighlight lang="rubyjulia">tobigrational(s) = (d = length(s) - something(findfirst(==('.'), s), 0); parse(BigInt, replace(s, '.' => "")) // big"10"^d)
 
toEngel(x) = (a = BigInt[]; while x != 0; y = ceil(big"1" // x); push!(a, y); x = x * y - 1; end; a)
4,105

edits