Jump to content

Fairshare between two and more: Difference between revisions

no edit summary
(Fairshare between two and more en FreeBASIC)
No edit summary
Line 1,279:
With 50000 people: 1
With 50001 people: Only 50000 have a turn</pre>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<lang Mathematica>ClearAll[Fairshare]
Fairshare[n_List, b_Integer : 2] := Fairshare[#, b] & /@ n
Fairshare[n_Integer, b_Integer : 2] := Mod[Total[IntegerDigits[n, b]], b]
Fairshare[Range[0, 24], 2]
Fairshare[Range[0, 24], 3]
Fairshare[Range[0, 24], 5]
Fairshare[Range[0, 24], 11]</lang>
{{out}}
<pre>{0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0}
{0,1,2,1,2,0,2,0,1,1,2,0,2,0,1,0,1,2,2,0,1,0,1,2,1}
{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}
{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|Nim}}==
1,111

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.