Sum of first n cubes: Difference between revisions
Content added Content deleted
(RPL: add section) |
(added Vtl-2) |
||
Line 2,119: | Line 2,119: | ||
672400 741321 815409 894916 980100 |
672400 741321 815409 894916 980100 |
||
1071225 1168561 1272384 1382976 1500625 |
1071225 1168561 1272384 1382976 1500625 |
||
</pre> |
|||
=={{header|VTL-2}}== |
|||
Based on the TinyBASIC sample but with multiple sums per line and showing the first 23 values as VTL-2 has unsigned 16-bit integers. |
|||
<syntaxhighlight lang="vtl2"> |
|||
10 C=0 |
|||
20 N=0 |
|||
30 C=N*N*N+C |
|||
40 ?=C |
|||
50 $=9 |
|||
60 N=N+1 |
|||
70 #=N/6*0+%>1*90 |
|||
80 ?="" |
|||
90 #=N<23*30 |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
0 1 9 36 100 225 |
|||
441 784 1296 2025 3025 4356 |
|||
6084 8281 11025 14400 18496 23409 |
|||
29241 36100 44100 53361 64009 |
|||
</pre> |
</pre> |
||