Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
10 LET n=41: LET k=3: LET m=0
|
||||
20 GO SUB 100
|
||||
30 PRINT "n= ";n;TAB (7);"k= ";k;TAB (13);"final survivor= ";lm
|
||||
40 STOP
|
||||
100 REM Josephus
|
||||
110 REM Return m-th on the reversed kill list; m=0 is final survivor.
|
||||
120 LET lm=m: REM Local copy of m
|
||||
130 FOR a=m+1 TO n
|
||||
140 LET lm=FN m(lm+k,a)
|
||||
150 NEXT a
|
||||
160 RETURN
|
||||
200 DEF FN m(x,y)=x-INT (x/y)*y: REM MOD function
|
||||
Loading…
Add table
Add a link
Reference in a new issue