Talk:Josephus problem: Difference between revisions

Line 137:
;4. contractacycle<nowiki>:</nowiki> AppleScript[2], Groovy
:Method: executioner walks along killing every k'th prisoner; queue contracts to remove gaps while he walks back. (reverts to one at a time once queue too small, as next)
;5. contractalot<nowiki>:</nowiki> AutoHotkey, C#, C++, Frink, Formulae, Java (both), JavaScript[2], Julia[2], Kotlin, Lua, NanoQuery, Nim, Objeck, Oforth, Processing, Python[1], R[2], Rust, Seed7, Swift, VBScript, Vedit, VisualBasic.NET, XPL0, zkl.
:Method: executioner walks round and round, queue contracts after every kill. (This is a mix of your 3 and 5, but not MATLAB or REXX or AWK)
;6. recursive<nowiki>:</nowiki> Emacs Lisp, Icon, Julia[1], PARI/GP, PicoLisp (less the optms.n), Sidef[2] (Your 4, but not Erlang)
Line 150:
: The Forth solution is another iterative mod maths solution like R, except it uses hard coded input. (Less stack shuffling that way?) --[[User:Chunes|Chunes]] ([[User talk:Chunes|talk]]) 04:07, 27 June 2020 (UTC)
:Very impressive! Studying this will keep me busy for days.--[[User:ReeceGoding|ReeceGoding]] ([[User talk:ReeceGoding|talk]]) 18:16, 27 June 2020 (UTC)
::In the new R solution, I found it odd that you wrote
It is 1-indexed, meaning that we will have a tough time using most solutions that exploit modular arithmetic.
::(1) it is just below the existing R "Growing circle solution" which uses modular atithmetic, and
::(2) Phix has 1-based indexes and it didn't bother me. Anyway, I added R[2] to "contractalot". --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 20:43, 30 June 2020 (UTC)
7,795

edits