Smallest square that begins with n: Difference between revisions

Add SETL
(Add Miranda)
(Add SETL)
 
Line 3,266:
49: 49 is 7 squared
</pre>
 
=={{header|SETL}}==
<syntaxhighlight lang="setl">program smallest_square_that_begins_with_n;
loop for n in [1..49] do
nprint(lpad(str smallest_prefix_square n, 7));
if n mod 10=0 then print; end if;
end loop;
print;
 
op begins_with(n, s);
loop while n>s do
n div:= 10;
end loop;
return n=s;
end op;
 
op smallest_prefix_square(n);
loop until s*s begins_with n do
s +:= 1;
end loop;
return s*s;
end op;
end program;</syntaxhighlight>
{{out}}
<pre> 1 25 36 4 529 64 729 81 9 100
1156 121 1369 144 1521 16 1764 1849 196 2025
2116 225 2304 2401 25 2601 2704 289 2916 3025
3136 324 3364 3481 35344 36 3721 3844 3969 400
41209 4225 4356 441 45369 4624 4761 484 49</pre>
 
=={{header|Sidef}}==
Line 3,288 ⟶ 3,317:
 
# Numbered list item
 
=={{header|TXR}}==
 
2,124

edits