Equilibrium index: Difference between revisions
Content added Content deleted
(→{{header|Picat}}: Moved into subsections, added {{out}}) |
|||
Line 2,100: | Line 2,100: | ||
=={{header|Picat}}== |
=={{header|Picat}}== |
||
Note: Picat is 1-based. |
Note: Picat is 1-based. |
||
===Prolog-style=== |
|||
{{trans|Prolog}} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
===Loop approach=== |
|||
{{trans|Java}} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
Test the approaches. |
|||
<lang Picat>go => |
<lang Picat>go => |
||
As = [ |
As = [ |
||
Line 2,131: | Line 2,156: | ||
println(r2=R2), |
println(r2=R2), |
||
nl. |
nl.</lang> |
||
% Inspired by the Prolog solution |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
% From the Java solution |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
</lang> |
|||
{{out}} |
|||
Output: |
|||
⚫ | |||
<pre> |
|||
⚫ | |||
all1 = [4,7] |
all1 = [4,7] |
||
all2 = [4,7] |
all2 = [4,7] |
||
Line 2,186: | Line 2,187: | ||
CPU time 0.019 seconds. |
CPU time 0.019 seconds. |
||
r2 = [115,372,4082,4254,4258,4261] |
r2 = [115,372,4082,4254,4258,4261]</pre> |
||
</pre> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |