Fairshare between two and more: Difference between revisions
Content added Content deleted
(add RPL) |
|||
Line 689: | Line 689: | ||
5: 0 1 2 3 4 1 2 3 4 0 2 3 4 0 1 3 4 0 1 2 4 0 1 2 3 |
5: 0 1 2 3 4 1 2 3 4 0 2 3 4 0 1 3 4 0 1 2 4 0 1 2 3 |
||
11: 0 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 0 2 3 4</pre> |
11: 0 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 0 2 3 4</pre> |
||
=={{header|EasyLang}}== |
|||
{{trans|Cowgol}} |
|||
<syntaxhighlight lang="easylang"> |
|||
proc fairshare ind base . r . |
|||
r = 0 |
|||
while ind > 0 |
|||
r = r + ind mod base |
|||
ind = ind div base |
|||
. |
|||
r = r mod base |
|||
. |
|||
proc sequence n base . . |
|||
write base & ": " |
|||
for ind range0 n |
|||
call fairshare ind base r |
|||
write r & " " |
|||
. |
|||
print "" |
|||
. |
|||
call sequence 25 2 |
|||
call sequence 25 3 |
|||
call sequence 25 5 |
|||
call sequence 25 11 |
|||
</syntaxhighlight> |
|||
=={{header|D}}== |
=={{header|D}}== |