Product of divisors: Difference between revisions
Content added Content deleted
(→{{header|ALGOL W}}: Added additional sample: translation of the Fortran "sieve" based sample) |
(Added VTL-2) |
||
Line 1,613: | Line 1,613: | ||
end |
end |
||
endmodule</lang> |
endmodule</lang> |
||
=={{header|VTL-2}}== |
|||
This sample only shows the divisor products of the first 20 numbers as (the original) VTL-2 only handles numbers in the range 0-65535. The divisor product of 24 would overflow.<br> |
|||
Note, all VTL-2 operators are single characters, however though the "<" operator does a lexx-than test, the ">" operator tests greater-than-or-equal.<br> |
|||
<lang VTL2>100 M=20 |
|||
110 I=0 |
|||
120 I=I+1 |
|||
130 :I)=1 |
|||
140 #=I<M*120 |
|||
150 I=0 |
|||
160 I=I+1 |
|||
170 J=0 |
|||
180 J=J+I |
|||
190 :J)=:J)*I |
|||
200 #=J<M*180 |
|||
210 #=I<M*160 |
|||
220 I=0 |
|||
230 I=I+1 |
|||
240 V=:I) |
|||
250 #=V>10*270 |
|||
260 $=32 |
|||
270 #=V>100*290 |
|||
280 $=32 |
|||
290 #=V>1000*310 |
|||
300 $=32 |
|||
310 #=V>10000*330 |
|||
320 $=32 |
|||
330 ?=:I) |
|||
340 $=32 |
|||
350 #=I/5*0+%=0=0*370 |
|||
360 ?="" |
|||
370 #=I<M*230</lang> |
|||
{{out}} |
|||
<pre> |
|||
1 2 3 8 5 |
|||
36 7 64 27 100 |
|||
11 1728 13 196 225 |
|||
1024 17 5832 19 8000 |
|||
</pre> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |