Fairshare between two and more: Difference between revisions

add RPL
m (→‎{{header|Perl}}: prepend Free Pascal)
(add RPL)
Line 2,225:
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>
 
=={{header|RPL}}==
<code>DIGITS</code> is defined at [[Sum digits of an integer#RPL|Sum digits of an integer]].
 
<code>D→B</code> is a slightly modified version of the program defined at [[Non-decimal radices/Convert#RPL|Non-decimal radices/Convert]], using uppercase characters to be compatible with <code>DIGITS</code>
≪ → b
≪ "" SWAP
'''WHILE''' DUP '''REPEAT'''
b MOD LAST / IP
SWAP DUP 9 > 55 48 IFTE + CHR
ROT + SWAP
'''END''' DROP
≫ ≫ '<span style="color:blue">D→B</span>' STO
≪ → b
≪ { 0 } 1 24 '''FOR''' j
j b <span style="color:blue">D→B</span> <span style="color:blue">DIGITS</span> b MOD + '''NEXT'''
≫ ≫ '<span style="color:blue">TASK</span>' STO
 
2 <span style="color:blue">TASK</span> 3 <span style="color:blue">TASK</span> 5 <span style="color:blue">TASK</span> 11 <span style="color:blue">TASK</span>
{{out}}
<pre>
4: { 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 }
3: { 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 }
2: { 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 }
1: { 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>
 
1,150

edits