Special factorials: Difference between revisions

Content added Content deleted
(Added PureBasic)
(Added Quackery.)
Line 1,734:
rf(119) : undefined
</pre>
 
=={{header|Quackery}}==
 
<syntaxhighlight lang="Quackery">
[ 1 & ] is odd ( n --> b )
 
[ 1 swap
[ 10 / dup 0 > while
dip 1+ again ]
drop ] is digitcount ( n --> n )
 
[ 1 1 rot times
[ i^ 1+ *
tuck * swap ]
drop ] is s! ( n --> n )
 
[ 1 swap times
[ i^ 1+ dup ** * ] ] is h! ( n --> n )
 
[ 0 1 rot times
[ i^ 1+ * tuck
i odd iff - else +
swap ]
drop ] is a! ( n --> n )
 
[ dup 0 = if done
dup 1 - recurse ** ] is **! ( n --> n )
 
[ this ] is undefined ( --> t )
 
[ dup 1 = iff
[ drop 0 ] done
1 swap
[ over /mod 0 != iff
[ drop undefined
swap ]
done
dip 1+
dup 1 = until
dip [ 1 - ] ]
drop ] is i! ( n --> n )
 
 
say "Superfactorials:" sp
10 times [ i^ s! echo sp ]
cr cr
say "Hyperfactorials:" sp
10 times [ i^ h! echo sp ]
cr cr
say "Alternating factorials: "
10 times [ i^ a! echo sp ]
cr cr
say "Exponential factorials: "
5 times [ i^ **! echo sp ]
cr cr
say "Number of digits in $5: "
5 **! digitcount echo
cr cr
say "Inverse factorials: "
' [ 1 2 6 24 119 120 720 5040
40320 362880 3628800 ]
witheach [ i! echo sp ]</syntaxhighlight>
 
{{out}}
 
<pre>Superfactorials: 1 1 2 12 288 34560 24883200 125411328000 5056584744960000 1834933472251084800000
 
Hyperfactorials: 1 1 4 108 27648 86400000 4031078400000 3319766398771200000 55696437941726556979200000 21577941222941856209168026828800000
 
Alternating factorials: 0 1 1 5 19 101 619 4421 35899 326981
 
Exponential factorials: 0 1 2 9 262144
 
Number of digits in $5: 183231
 
Inverse factorials: 0 2 3 4 undefined 5 6 7 8 9 10
</pre>
 
=={{header|Raku}}==
<syntaxhighlight lang="raku" line>sub postfix:<!> ($n) { [*] 1 .. $n }