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">
proc fairshare ind base . r .
func fairshare ind base .
r = 0
while ind > 0
while ind > 0
r = r + ind mod base
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
call fairshare ind base r
write (fairshare ind base) & " "
write r & " "
.
.
print ""
print ""
.
.
call sequence 25 2
sequence 25 2
call sequence 25 3
sequence 25 3
call sequence 25 5
sequence 25 5
call sequence 25 11
sequence 25 11
</syntaxhighlight>
</syntaxhighlight>