Josephus problem: Difference between revisions

Content added Content deleted
m (J: Add spaces around the subtraction to help mislead eyes slightly less when they have been [mis-]trained by some OO syntax)
Line 1,031: Line 1,031:
=== Explicit version 2 ===
=== Explicit version 2 ===
<lang J>
<lang J>
Josephus2 =: 4 : '(|x&+)/i.->:y' NB. this is a direct translation of the algo from C code above.
Josephus2 =: 4 : '(|x&+)/i. - >:y' NB. this is a direct translation of the algo from C code above.


3 Josephus2 41
3 Josephus2 41