Smallest square that begins with n: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add Zig) |
(Add SenseTalk implementation) |
||
Line 1,572: | Line 1,572: | ||
48 484 22 |
48 484 22 |
||
49 49 7</pre> |
49 49 7</pre> |
||
=={{header|SenseTalk}}== |
|||
<lang sensetalk>repeat with n = 1 to 49 |
|||
put smallestNumberWhoseSquareBeginsWith(n) into num |
|||
put !"[[n]]: [[num squared]] is [[num]] squared" |
|||
end repeat |
|||
to handle smallestNumberWhoseSquareBeginsWith n |
|||
repeat forever |
|||
if the counter squared begins with n then return the counter |
|||
end repeat |
|||
end handler |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
1: 1 is 1 squared |
|||
2: 25 is 5 squared |
|||
3: 36 is 6 squared |
|||
4: 4 is 2 squared |
|||
5: 529 is 23 squared |
|||
6: 64 is 8 squared |
|||
7: 729 is 27 squared |
|||
8: 81 is 9 squared |
|||
9: 9 is 3 squared |
|||
10: 100 is 10 squared |
|||
11: 1156 is 34 squared |
|||
12: 121 is 11 squared |
|||
13: 1369 is 37 squared |
|||
14: 144 is 12 squared |
|||
15: 1521 is 39 squared |
|||
16: 16 is 4 squared |
|||
17: 1764 is 42 squared |
|||
18: 1849 is 43 squared |
|||
19: 196 is 14 squared |
|||
20: 2025 is 45 squared |
|||
21: 2116 is 46 squared |
|||
22: 225 is 15 squared |
|||
23: 2304 is 48 squared |
|||
24: 2401 is 49 squared |
|||
25: 25 is 5 squared |
|||
26: 2601 is 51 squared |
|||
27: 2704 is 52 squared |
|||
28: 289 is 17 squared |
|||
29: 2916 is 54 squared |
|||
30: 3025 is 55 squared |
|||
31: 3136 is 56 squared |
|||
32: 324 is 18 squared |
|||
33: 3364 is 58 squared |
|||
34: 3481 is 59 squared |
|||
35: 35344 is 188 squared |
|||
36: 36 is 6 squared |
|||
37: 3721 is 61 squared |
|||
38: 3844 is 62 squared |
|||
39: 3969 is 63 squared |
|||
40: 400 is 20 squared |
|||
41: 41209 is 203 squared |
|||
42: 4225 is 65 squared |
|||
43: 4356 is 66 squared |
|||
44: 441 is 21 squared |
|||
45: 45369 is 213 squared |
|||
46: 4624 is 68 squared |
|||
47: 4761 is 69 squared |
|||
48: 484 is 22 squared |
|||
49: 49 is 7 squared |
|||
</pre> |
|||
=={{header|Sidef}}== |
=={{header|Sidef}}== |