RosettaCodeData/Task/Josephus-problem/Icon/josephus-problem-1.icon
2023-07-01 13:44:08 -04:00

9 lines
215 B
Text

procedure main(A)
m := integer(A[1]) | 41
c := integer(A[2]) | 3
write("With ",m," men, counting to ",c," last position is: ", j(m,c))
end
procedure j(m,c)
return if m==1 then 0 else (j(m-1,c)+c)%m
end