Talk:Special factorials: Difference between revisions
→Reverse factorial algorithm: Fixed syntax highlighting
No edit summary |
(→Reverse factorial algorithm: Fixed syntax highlighting) |
||
Line 1:
=== Reverse factorial algorithm ===
I took a stab at translating the reverse factorial algorithm used in the Factor entry to Java. It should be almost as efficient as taking the factorial itself.
<syntaxhighlight lang="java">
if (n == 1)
return 0; //1 has two answers -- return the lower one
Line 14 ⟶ 15:
return b;
else return -1; //undefined
}
</syntaxhighlight>
--[[User:Chunes|Chunes]] ([[User talk:Chunes|talk]]) 17:06, 16 March 2021 (UTC)
|