Smallest square that begins with n: Difference between revisions

Added 11l
(Added solution for Action!)
(Added 11l)
Line 4:
Find the smallest &nbsp;(decimal integer)&nbsp; squares that begin with &nbsp; &nbsp; <big> '''n''' </big> &nbsp; &nbsp; for &nbsp; <big> 0 &lt; '''n''' &lt; 50 </big>
<br><br>
 
=={{header|11l}}==
<lang 11l>F firstSquareWithPrefix(n)
V pfx = String(n)
L(x) 0..
V s = String(x * x)
I s.starts_with(pfx)
R Int(s)
 
L(x) 0 <.< 50
print(firstSquareWithPrefix(x))</lang>
 
{{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|Action!}}==
1,481

edits