Talk:Special factorials: Difference between revisions

m (→‎Why is af(0) 0?: variables)
Line 2:
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.
<lang java>public static int rf(int n) {
if (n == 1)
return 0;
 
int a = 1;
int b = 1;
Line 14 ⟶ 17:
--[[User:Chunes|Chunes]] ([[User talk:Chunes|talk]]) 17:06, 16 March 2021 (UTC)
 
: Note that the &nbsp; ''factorial inverse'' &nbsp; (or &nbsp;''reverse factorial'') &nbsp; of &nbsp; '''unity''' &nbsp; has two possible answers: &nbsp; '''zero''' &nbsp; and &nbsp; '''unity'''.
 
: It is normal when searching a series &nbsp; (in this case, the series of factorial products) &nbsp; to use the first match found in the series. &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 17:37, 16 March 2021 (UTC)
 
:: Good catch. I revised the algorithm above and will make a note about it in the task description. --[[User:Chunes|Chunes]] ([[User talk:Chunes|talk]]) 17:58, 16 March 2021 (UTC)
 
=== Why is af(0) 0? ===
1,808

edits