λ-wiki
::
factorielle
+
| 1 |
help
|
pages
|
skin
|
login
|
code
www!k! v.20120610
! CE SITE NECESSITE JAVASCRIPT !
λ-wiki :: éditeur
{h4 factorial n!} {p Source : {a {@ href:http://en.wikipedia.org/wiki/Factorial;} wikipedia }.} {h3 1) coding} {p Code below is written in the editor window :} {div {@ id:code; white-space:pre; border:1px solid; padding:5px;} °° var fact = function ( n ) { return (n >0)? n * fact(n-1) : 1; } $('output').innerHTML = fact( $('A').value ); °°} {h3 2) display} {p Factorial( {input {@ code:code; id:A; width:50px; value:input;} }) = {span {@ id:output;} ???} } {p Do you know why the number of leadings zeroes of 20! is 4 ? Because 20! contains 2, 4, 5, 10, 15 and 20, so 10 - >1, 20 - >2, 2x5=10 - >3 and 4x15=60 - >4. }