Smallest square that begins with n: Difference between revisions
→{{header|TXR}}: Translation of BASIC.
(→{{header|TXR}}: Terse solution.) |
(→{{header|TXR}}: Translation of BASIC.) |
||
Line 2,390:
</pre>
# Numbered list item
=={{header|TXR}}==
===One Pass Through Squares===
In this solution we avoid calculating squares; no multiplication occurs in the code.
Line 2,458 ⟶ 2,461:
48 484
49 49</pre>
===Terse===
The following inefficient-but-terse solution produces the same output:
Line 2,466 ⟶ 2,471:
(pic "## ########" n)
put-line))</syntaxhighlight>
===Loopy===
{{trans|BASIC}}
<syntaxhighlight lang="txrlisp">(each ((i 1..50))
(block search
(each ((j 1))
(for ((k (square j)))
((> k i) (when (eql k i)
(put-line (pic "## ########" i (square j)))
(return-from search)))
((set k (trunc k 10)))))))</syntaxhighlight>
=={{header|VTL-2}}==
|