Fairshare between two and more: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 693: | Line 693: | ||
{{trans|Cowgol}} |
{{trans|Cowgol}} |
||
<syntaxhighlight lang="easylang"> |
<syntaxhighlight lang="easylang"> |
||
func fairshare ind base . |
|||
r = 0 |
|||
while ind > 0 |
while ind > 0 |
||
r += ind mod base |
|||
ind = ind div base |
ind = ind div base |
||
. |
. |
||
r = r mod base |
r = r mod base |
||
return r |
|||
. |
. |
||
proc sequence n base . . |
proc sequence n base . . |
||
write base & ": " |
write base & ": " |
||
for ind range0 n |
for ind range0 n |
||
write (fairshare ind base) & " " |
|||
write r & " " |
|||
. |
. |
||
print "" |
print "" |
||
. |
. |
||
sequence 25 2 |
|||
sequence 25 3 |
|||
sequence 25 5 |
|||
sequence 25 11 |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||