Factorions: Difference between revisions

Added AutoHotkey
(Added AutoHotkey)
Line 134:
The factorions for base 12 are:
1 2</pre>
 
=={{header|AutoHotkey}}==
{{trans|C}}
<lang AutoHotkey>fact:=[]
fact[0] := 1
while (A_Index < 12)
fact[A_Index] := fact[A_Index-1] * A_Index
b := 9
while (b <= 12) {
res .= "base " b " factorions: `t"
while (A_Index < 1500000){
sum := 0
j := A_Index
while (j > 0){
d := Mod(j, b)
sum += fact[d]
j /= b
}
if (sum = A_Index)
res .= A_Index " "
}
b++
res .= "`n"
}
MsgBox % res
return</lang>
{{out}}
<pre>
base 9 factorions: 1 2 41282
base 10 factorions: 1 2 145 40585
base 11 factorions: 1 2 26 48 40472
base 12 factorions: 1 2 </pre>
 
=={{header|AWK}}==
299

edits