Smallest square that begins with n: Difference between revisions

added Raku programming solution
m (→‎{{header|Wren}}: Removed redundant spaces.)
(added Raku programming solution)
Line 93:
9: 9 (3^2) 19: 196 (14^2) 29: 2916 (54^2) 39: 3969 (63^2) 49: 49 (7^2)
10: 100 (10^2) 20: 2025 (45^2) 30: 3025 (55^2) 40: 400 (20^2)
</pre>
 
=={{header|Raku}}==
<lang perl6># 20210319 Raku programming solution
 
my @needles = (1..49);
my @haystack = (1..*) Z* (1..*);
for @needles -> \needle {
for @haystack -> \hay {
{ say needle, " => ", hay and last } if hay.starts-with: needle
}
}</lang>
{{out}}
<pre>
1 => 1
2 => 25
3 => 36
4 => 4
5 => 529
6 => 64
7 => 729
8 => 81
9 => 9
10 => 100
11 => 1156
12 => 121
13 => 1369
14 => 144
15 => 1521
16 => 16
17 => 1764
18 => 1849
19 => 196
20 => 2025
21 => 2116
22 => 225
23 => 2304
24 => 2401
25 => 25
26 => 2601
27 => 2704
28 => 289
29 => 2916
30 => 3025
31 => 3136
32 => 324
33 => 3364
34 => 3481
35 => 35344
36 => 36
37 => 3721
38 => 3844
39 => 3969
40 => 400
41 => 41209
42 => 4225
43 => 4356
44 => 441
45 => 45369
46 => 4624
47 => 4761
48 => 484
49 => 49
</pre>
 
353

edits