Square but not cube: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add 8086 assembly) |
Not a robot (talk | contribs) (Add Forth) |
||
Line 786: | Line 786: | ||
1089 |
1089 |
||
</pre> |
</pre> |
||
=={{header|Forth}}== |
|||
<lang forth>: square dup * ; |
|||
: cube dup dup * * ; |
|||
: 30-non-cube-squares |
|||
0 1 1 |
|||
begin 2 pick 30 < while |
|||
begin over over square swap cube > while |
|||
swap 1+ swap |
|||
repeat |
|||
over over square swap cube <> if |
|||
dup square . rot 1+ -rot |
|||
then |
|||
1+ |
|||
repeat |
|||
2drop drop |
|||
; |
|||
30-non-cube-squares cr bye</lang> |
|||
{{out}} |
|||
<pre>4 9 16 25 36 49 81 100 121 144 169 196 225 256 289 324 361 400 441 484 529 576 625 676 784 841 900 961 1024 1089</pre> |
|||
=={{header|Go}}== |
=={{header|Go}}== |