Josephus problem variation and it's output (general case)
Background: this is my way of gently easing myself back into the study of maths and cs, specifically functional programming (this a hobby and not homework). I chose Excel after learning that spreadsheets are sometimes described as being primitive FP and wanted the challenge of using only worksheet functions to solve various problems as a precursor to learning a FP language such as Haskell.
Problem: I'm trying to model a counting out problem within MS Excel and seek help on the maths please.
I want to be able to produce a table/grid showing all the eliminations and I want to do this in two ways and for any size circle/list and count:
1. e.g. list=8, count =5 (begin with 1)
2. this time contract the list
I have looked at the maths for the Josephus problem (going direct to the "last man standing") found for instance on Wikipedia, but am struggling to modify/adapt this to produce the output of each elimination. I need an introduction to solving this type of problem please. Intuitively I see the use of mod and clock arithmetic but have so far failed to come up with the goods
Re: Josephus problem variation and it's output (general case)
Write a function that takes two positive integers n and k as arguments and returns the number of the last person remaining out of n after counting out each k-th person.
This is a code-golf challenge, so the shortest code wins.
Even Giants Born Small
Free neuropathy remedy