This site is supported by donations to The OEIS Foundation.
Template:Factorial/test
From OeisWiki
{{Factorial/test}} is the template testing template for the {{factorial}} mathematical function template.
Valid input
Returns as an exact integer for nonnegative integers in [0..16], otherwise returns an error message.
Test
Code |
| ||
---|---|---|---|
{{factorial}} | 1 | (empty product) | |
0 | {{factorial|0}} | 1 | TRUE |
1 | {{factorial|1}} | 1 | TRUE |
2 | {{factorial|2}} | 2 | TRUE |
3 | {{factorial|3}} | 6 | TRUE |
4 | {{factorial|4}} | 24 | TRUE |
5 | {{factorial|5}} | 120 | TRUE |
6 | {{factorial|6}} | 720 | TRUE |
7 | {{factorial|7}} | 5040 | TRUE |
8 | {{factorial|8}} | 40320 | TRUE |
9 | {{factorial|9}} | 362880 | TRUE |
10 | {{factorial|10}} | 3628800 | TRUE |
11 | {{factorial|11}} | 39916800 | TRUE |
12 | {{factorial|12}} | 479001600 | TRUE |
13 | {{factorial|13}} | 6227020800 | TRUE |
14 | {{factorial|14}} | 87178291200 | TRUE |
15 | {{factorial|15}} | 1307674368000 | TRUE |
16 | {{factorial|16}} | 20922789888000 | TRUE |
17 | {{factorial|17}} | Factorial error: Argument must be a nonnegative integer up to 16 | |
18 | {{factorial|18}} | Factorial error: Argument must be a nonnegative integer up to 16 | |
19 | {{factorial|19}} | Factorial error: Argument must be a nonnegative integer up to 16 | |
20 | {{factorial|20}} | Factorial error: Argument must be a nonnegative integer up to 16 | |
-1 | {{factorial|-1}} | Factorial error: Argument must be a nonnegative integer up to 16 | |
-0.5 | {{factorial|-0.5}} | Factorial error: Argument must be an integer | |
0.5 | {{factorial|0.5}} | Factorial error: Argument must be an integer | |
text | {{factorial|text}} | Factorial error: Argument must be an integer | |
2 blobs | {{factorial|2 blobs}} | Factorial error: Argument must be an integer | |
-2 blobs | {{factorial|-2 blobs}} | Factorial error: Argument must be an integer | |
number3 | {{factorial|number3}} | Factorial error: Argument must be an integer | |
number 3 | {{factorial|number 3}} | Factorial error: Argument must be an integer |
Code
<noinclude>{{Documentation}}</noinclude><includeonly>{{ifint| ( {{{1|1}}} ) <!-- No argument: empty product, giving 1. --> | {{#ifexpr: ( ( {{{1|1}}} ) >= 0 ) and ( ( {{{1|1}}} ) <= 16 ) | {{#expr: 1 <!-- 0! --> {{#ifexpr: ( {{{1|1}}} ) >= 01 | *1 {{#ifexpr: ( {{{1|1}}} ) >= 02 | *2 {{#ifexpr: ( {{{1|1}}} ) >= 03 | *3 {{#ifexpr: ( {{{1|1}}} ) >= 04 | *4 {{#ifexpr: ( {{{1|1}}} ) >= 05 | *5 <!-- 5! --> {{#ifexpr: ( {{{1|1}}} ) >= 06 | *6 {{#ifexpr: ( {{{1|1}}} ) >= 07 | *7 {{#ifexpr: ( {{{1|1}}} ) >= 08 | *8 {{#ifexpr: ( {{{1|1}}} ) >= 09 | *9 {{#ifexpr: ( {{{1|1}}} ) >= 10 | *10 <!-- 10! --> {{#ifexpr: ( {{{1|1}}} ) >= 11 | *11 {{#ifexpr: ( {{{1|1}}} ) >= 12 | *12 {{#ifexpr: ( {{{1|1}}} ) >= 13 | *13 {{#ifexpr: ( {{{1|1}}} ) >= 14 | *14 {{#ifexpr: ( {{{1|1}}} ) >= 15 | *15 <!-- 15! --> {{#ifexpr: ( {{{1|1}}} ) >= 16 | *16 }} }} <!-- 15! --> }} }} }} }} }} <!-- 10! --> }} }} }} }} }} <!-- 5! --> }} }} }} }} }} <!-- 0! --> | {{error| Factorial error: Argument must be a [[Nonnegative integers|nonnegative integer]] up to 16 }} }} | {{error| Factorial error: Argument must be an integer }} }}</includeonly>