Distribution of 0 digits in factorial series: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: rewrite the function to strictly comply with the task's requirements, simplified the code.) |
|||
Line 227: | Line 227: | ||
do j=1 for #; n= word($, j) /*calculate some factorial ranges. */ |
do j=1 for #; n= word($, j) /*calculate some factorial ranges. */ |
||
⚫ | |||
p= 0dist(n) /* " the proportion of zeros. */ |
|||
⚫ | |||
end /*j*/ |
end /*j*/ |
||
Line 236: | Line 235: | ||
commas: parse arg ?; do jc=length(?)-3 to 1 by -3; ?=insert(',', ?, jc); end; return ? |
commas: parse arg ?; do jc=length(?)-3 to 1 by -3; ?=insert(',', ?, jc); end; return ? |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
0dist: procedure; parse arg |
0dist: procedure; parse arg z; != 1; y= 0 |
||
do k=1 for |
do k=1 for z; != ! * k; y= y + countstr(0, !) / length(!)</lang> |
||
end /*k*/ |
|||
return y</lang> |
|||
{{out|output|text= when using the default inputs:}} |
{{out|output|text= when using the default inputs:}} |
||
<pre> |
<pre> |