Josephus problem: Difference between revisions

Line 1,806:
Josephus(41,2,1) -> 30 / 2 5 8 11 14 17 20 23 26 29 32 35 38 0 4 9 13 18 22 27 31 36 40 6 12 19 25 33 39 7 16 28 37 10 24 1 21 3 34 15
Josephus(23482,3342,3) -> 1087 1335 13317 / 3342 6685 10028 13371 16714 20057 23400 3261 6605 9949 13293 16637 19981 23325 3187 6532 9877 13222 16567 19912 23257 3120 6466 9812 13158 16504 19850 23196 3060 6407 9754 13101 16448 19795 23142 3007 6355 9703 13051 16399 19747 23095 2961 6310 9659 ...</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
n = 41
k = 3
for i = 1 to n
lm = (lm + k) mod i
.
print "prisoners: " & n
print "step size: " & k
print "final survivor: " & lm
</syntaxhighlight>
 
=={{header|EchoLisp}}==
2,069

edits