Integer roots: Difference between revisions

→‎{{header|Julia}}: fixed bug, made it more Julian
(→‎{{header|Julia}}: fixed bug, made it more Julian)
Line 463:
 
=={{header|Julia}}==
{{works with|Julia|01.63}}
{{trans|Python}}
 
<lang julia>function iroot(a, b)
if b < 2 && return b end
a1, c = a - 1, 1
d = (a1 * c + b ÷ (c ^ a1)) ÷ a
e = (a1 * d + b ÷ (d ^ a1)) ÷ a
while cd != dc != e
c, d, e = d, e, (a1 * e + b ÷ (e ^ a1)) ÷ a
end
 
return min(d, e)
end