# Joshephus or MamakoDate Sequence EASY

## Submit

File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

## Problem

For given intergers M N, arrange integers from 1 to M, inclusive, in a circle, and repeat to remove and show every N-th(circular) one until there are none.

FYI. Brief description about Sample input No.1
41 3 for: Josephus problem: Survived Josephus & his friend = No.16 & 31 or No.31 & 16
30 9 for: Throw every 9th from the wrecked ship 15 times: AAAABBBBBAABAAABABBAABBBABBAAB 5 6 2 1 3 1 1 2 2 3 1 2 2 1
30 10 for: Every 10th: AABAAABBBBBAABBAAAABABBBABBAAB 2 1 3 5 2 2 4 1 1 3 1 2 2 1
30 10 for: MamakoDate: Until the last remained stepchild(No.14) claimed the condition was unfair
16 10 for: MamakoDate: After the stepmother(for No.14) agreed to continue after renumbering the stepchild as No.1
13 2 for: Sorting "A 2 3 ... Q K" keying on this series gives the "7 A Q 2 8 3 J 4 9 5 K 6 10" sequence.
www.cut-the-knot.org/recurrence/ancient.shtml Story
user.math.uzh.ch/halbeisen/publications/pdf/jos.pdf HARD
edb.kulib.kyoto-u.ac.jp/tenjikai/2003/zuroku/pdf/2.pdf MamakoDate pics
MamakoDate is a Japanese tale "How the stepchild(_mamako_) won the heirship."

## Options

exec is denied

now post-mortem time, all source codes will be revealed

```41 3
30 9
30 10
30 10
16 10
13 2
```

## Sample output:

```3 6 9 12 15 18 21 24 27 30 33 36 39 1 5 10 14 19 23 28 32 37 41 7 13 20 26 34 40 8 17 29 38 11 25 2 22 4 35 16 31
9 18 27 6 16 26 7 19 30 12 24 8 22 5 23 11 29 17 10 2 28 25 1 4 15 13 14 3 20 21
10 20 30 11 22 3 15 27 9 24 7 23 8 26 14 2 21 16 6 4 1 5 13 19 12 29 18 25 17 28
10 20 30 11 22 3 15 27 9 24 7 23 8 26 14 2 21 16 6 4 1 5 13 19 12 29 18 25 17 28
10 4 15 11 7 5 3 6 9 14 8 2 13 16 12 1
2 4 6 8 10 12 1 5 9 13 7 3 11
```

```21 17
39 14
24 21
25 19
50 16
21 20
13 20
11 14
58 2
25 4
41 18
25 6
54 13
58 5
21 8
35 19
38 10
32 13
14 19
39 11
51 6
28 11
37 14
44 15
52 17
48 10
18 18
15 9
7 7
11 5
57 11
9 9
5 10
49 7
11 11
18 13
59 17
38 14
57 2
47 9
26 4
51 21
47 21
51 15
37 20
17 10
57 4
12 17
41 17
34 21
44 2
25 19
13 21
22 7
39 2
41 11
47 7
7 13
40 12
19 15
9 9
31 7
21 15
46 6
54 21
57 9
58 15
29 18
6 11
51 8
54 6
26 14
42 4
59 18
11 12
58 20
9 21
28 2
50 6
31 20
21 7
53 6
50 4
40 15
7 14
16 3
34 6
30 11
42 20
29 9
7 18
47 4
56 3
13 21
45 11
42 21
28 12
50 4
36 17
33 17
```

## Sample output:

```17 13 10 8 7 9 12 16 21 5 19 11 4 6 18 14 20 1 3 15 2
14 28 3 18 33 9 25 2 20 37 16 35 15 36 19 1 24 8 32 22 10 39 30 26 21 17 23 29 38 7 31 12 11 27 6 34 5 4 13
21 18 16 15 17 20 24 4 9 19 6 22 11 8 10 14 5 3 13 23 1 12 2 7
19 13 8 4 1 24 23 25 3 7 12 18 6 17 11 9 10 16 5 14 22 20 21 2 15
16 32 48 14 31 49 17 35 3 22 41 10 30 2 24 45 19 42 15 40 18 44 23 1 29 9 43 27 11 50 37 28 21 13 12 20 26 36 47 8 46 34 33 39 7 25 6 38 5 4
20 19 21 2 5 9 14 3 12 6 18 17 4 11 8 13 10 7 16 15 1
7 2 12 11 1 6 4 8 5 3 10 9 13
3 7 1 9 8 11 6 2 5 4 10
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 3 7 11 15 19 23 27 31 35 39 43 47 51 55 1 9 17 25 33 41 49 57 13 29 45 5 37 21 53
4 8 12 16 20 24 3 9 14 19 25 6 13 21 2 11 22 7 18 10 1 23 5 17 15
18 36 13 32 10 30 9 31 12 35 17 41 24 7 37 22 8 40 28 21 15 6 4 3 5 14 20 27 39 23 1 33 29 38 19 16 34 11 2 26 25
6 12 18 24 5 13 20 2 10 19 3 14 23 9 22 11 1 17 15 8 16 25 21 7 4
13 26 39 52 11 25 40 54 15 30 45 6 22 38 2 19 36 1 20 41 5 27 47 14 35 7 31 53 28 51 29 4 34 12 46 24 10 49 42 32 21 18 23 37 48 9 44 33 43 8 16 17 50 3
5 10 15 20 25 30 35 40 45 50 55 2 8 14 21 27 33 39 46 52 58 7 16 23 31 38 47 54 4 13 24 34 43 53 6 18 29 42 56 11 26 41 57 17 36 51 19 44 9 37 12 49 32 28 48 3 22 1
8 16 3 12 21 10 20 11 2 15 7 4 19 18 1 6 14 13 5 17 9
19 3 23 8 29 15 2 26 14 5 31 22 16 10 6 1 35 4 9 13 21 30 12 28 20 17 18 27 11 24 34 32 33 7 25
10 20 30 2 13 24 35 8 21 33 7 22 36 12 27 4 19 38 17 37 18 3 26 11 34 28 16 14 9 15 25 32 23 6 31 1 29 5
13 26 7 21 3 18 1 17 2 20 6 25 12 32 24 15 9 4 30 29 31 8 14 23 11 5 10 22 27 28 16 19
5 11 4 14 12 13 3 10 1 8 6 7 9 2
11 22 33 5 17 29 2 15 28 3 18 32 8 24 39 19 36 14 35 16 38 23 7 31 21 10 4 37 34 1 9 20 30 26 27 13 6 12 25
6 12 18 24 30 36 42 48 3 10 17 25 32 39 46 2 11 20 28 37 45 4 14 23 34 44 5 16 29 41 1 19 33 49 13 31 50 21 40 9 38 15 47 27 22 8 26 43 35 7 51
11 22 5 17 1 14 27 13 28 16 4 21 10 3 24 19 15 12 18 23 2 9 7 8 26 20 25 6
14 28 5 20 35 13 30 9 26 7 25 8 29 12 34 19 4 32 21 11 2 36 31 27 33 1 10 18 3 23 22 37 17 6 16 15 24
15 30 1 17 33 5 22 39 12 31 6 25 44 21 42 20 43 24 4 29 11 38 26 10 41 34 23 16 13 9 14 19 32 40 18 2 36 37 8 7 35 28 3 27
17 34 51 16 35 1 20 39 6 26 46 14 37 7 29 52 24 48 22 47 23 50 28 5 36 13 45 31 12 2 40 27 18 10 8 4 9 15 25 38 49 32 11 44 3 30 19 33 41 43 21 42
10 20 30 40 2 13 24 35 46 9 22 34 47 12 26 39 5 19 36 3 18 37 6 25 43 15 33 8 31 7 32 14 42 23 4 44 29 27 21 28 41 1 38 17 48 11 45 16
18 1 3 6 10 15 7 16 12 11 14 5 4 13 2 17 9 8
9 3 13 8 5 2 1 4 7 12 10 11 6 14 15
7 1 3 6 2 4 5
5 10 4 11 7 3 2 6 9 1 8
11 22 33 44 55 9 21 34 46 1 14 27 40 53 10 25 39 54 13 29 45 4 20 38 57 18 37 2 23 43 7 31 52 24 49 17 48 19 51 30 6 42 28 12 3 50 47 56 8 26 41 35 36 16 5 15 32
9 1 3 6 4 5 2 7 8
5 2 3 1 4
7 14 21 28 35 42 49 8 16 24 32 40 48 9 18 27 37 46 6 19 30 41 3 15 29 43 5 22 36 2 20 38 10 26 47 23 45 25 4 34 17 12 11 13 33 1 31 39 44
11 1 3 6 10 8 9 5 2 4 7
13 8 4 1 17 16 18 3 7 12 6 2 5 11 14 15 9 10
17 34 51 9 27 45 4 23 42 2 22 43 5 26 48 11 33 56 20 46 12 37 3 31 58 29 57 30 1 36 10 44 19 55 39 18 6 49 35 24 15 13 8 14 21 32 47 59 40 16 54 7 38 25 41 50 53 28 52
14 28 4 19 34 11 27 6 23 2 21 1 22 5 26 10 33 18 8 35 25 16 12 7 3 9 15 24 32 17 37 36 13 31 20 30 29 38
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 7 15 23 31 39 47 55 11 27 43 3 35 19 51
9 18 27 36 45 7 17 28 38 1 12 23 34 46 11 24 37 3 16 31 44 14 30 47 19 35 6 26 2 22 43 25 5 33 15 4 40 32 29 39 42 13 8 10 41 20 21
4 8 12 16 20 24 2 7 13 18 23 3 10 17 25 6 15 26 11 22 14 5 1 9 21 19
21 42 12 34 5 28 51 24 48 22 47 23 50 27 4 33 11 41 20 6 38 19 8 44 32 18 13 3 49 45 43 46 2 10 17 31 1 26 7 36 30 35 40 25 16 39 9 14 37 15 29
21 42 16 38 13 36 12 37 15 41 20 47 27 7 35 22 4 34 24 9 46 33 28 19 14 10 8 11 18 26 32 45 17 40 23 2 44 1 6 39 31 5 25 29 3 30 43
15 30 45 9 25 41 6 23 40 7 26 44 12 32 51 20 42 13 35 5 31 3 29 4 34 11 39 19 50 36 18 2 46 33 24 21 17 22 28 43 1 27 8 48 49 16 14 47 38 10 37
20 3 24 8 30 15 1 26 13 2 29 19 11 5 35 32 28 27 31 34 4 10 18 36 16 6 25 23 37 14 9 17 12 7 22 21 33
10 3 14 8 4 17 15 13 16 2 7 1 12 6 9 5 11
4 8 12 16 20 24 28 32 36 40 44 48 52 56 3 9 14 19 25 30 35 41 46 51 57 6 13 21 27 34 42 49 55 7 17 26 37 45 54 10 22 33 47 2 18 38 53 15 39 5 31 11 50 43 1 29 23
5 11 7 4 6 10 8 12 1 3 9 2
17 34 10 28 5 24 2 22 1 23 4 27 9 33 16 41 30 15 6 36 26 19 13 11 8 12 18 25 35 3 31 14 40 7 29 20 32 37 39 21 38
21 8 30 18 7 32 23 14 6 1 29 26 24 22 25 28 34 5 13 27 10 31 16 12 15 20 9 4 19 33 2 17 3 11
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 3 7 11 15 19 23 27 31 35 39 43 5 13 21 29 37 1 17 33 9 41 25
19 13 8 4 1 24 23 25 3 7 12 18 6 17 11 9 10 16 5 14 22 20 21 2 15
8 4 2 3 7 13 12 6 9 10 5 11 1
7 14 21 6 15 1 10 19 8 18 9 22 13 5 3 2 4 12 20 11 16 17
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 1 5 9 13 17 21 25 29 33 37 3 11 19 27 35 7 23 39 31 15
11 22 33 3 15 27 39 10 24 37 9 25 40 14 30 5 21 41 18 36 17 38 20 4 29 13 2 32 26 19 16 23 31 1 12 7 8 35 28 34 6
7 14 21 28 35 42 2 10 18 26 34 43 4 13 23 32 41 5 16 27 38 1 15 29 40 8 22 37 6 24 44 12 33 9 31 11 39 20 3 46 45 47 19 36 17 25 30
6 7 3 4 5 1 2
12 24 36 8 21 34 7 22 37 11 27 2 18 35 14 31 10 30 13 33 17 1 26 15 3 32 25 20 19 23 29 40 9 4 39 6 5 38 28 16
15 11 8 6 5 7 10 14 19 9 1 17 18 4 3 16 13 2 12
9 1 3 6 4 5 2 7 8
7 14 21 28 4 12 20 29 6 16 25 3 15 26 8 19 1 17 31 18 5 24 13 10 9 11 23 2 22 27 30
15 9 4 21 18 16 14 17 20 3 8 19 10 6 7 13 12 5 2 11 1
6 12 18 24 30 36 42 2 9 16 23 31 38 45 7 15 25 33 41 4 14 26 35 46 11 22 37 3 19 32 1 20 39 10 29 8 34 17 44 40 28 43 13 5 27 21
21 42 9 31 53 22 45 14 38 8 34 5 32 4 33 7 37 13 44 20 52 30 15 49 29 17 1 43 28 23 12 6 2 54 3 11 19 27 41 10 36 16 47 40 46 51 35 26 50 18 24 48 25 39
9 18 27 36 45 54 6 16 26 37 47 57 11 22 33 44 56 12 24 38 50 5 20 34 49 7 23 40 55 15 32 52 14 35 1 21 43 10 39 4 31 8 42 19 53 41 28 17 13 25 30 51 46 48 29 2 3
15 30 45 2 18 34 50 8 25 42 1 20 38 56 17 37 57 21 41 5 27 49 13 39 6 31 55 26 53 24 54 29 4 36 12 48 32 11 52 43 28 19 14 10 16 23 40 51 22 58 46 47 9 7 44 35 3 33
18 7 26 16 8 29 22 15 11 6 4 3 5 10 14 21 28 17 1 24 23 27 13 12 25 9 2 20 19
5 6 3 1 2 4
8 16 24 32 40 48 5 14 23 33 42 51 10 20 30 41 1 12 25 36 47 9 22 37 50 15 29 45 11 28 46 17 35 4 27 2 26 3 34 13 44 38 21 19 31 43 7 6 39 18 49
6 12 18 24 30 36 42 48 54 7 14 21 28 35 43 50 3 11 20 29 38 46 1 10 22 32 41 52 9 23 34 47 5 19 37 51 15 31 49 16 39 4 27 2 33 13 45 40 26 44 8 53 25 17
14 2 17 6 22 12 4 23 16 10 7 3 1 5 9 15 21 11 25 24 8 20 13 19 18 26
4 8 12 16 20 24 28 32 36 40 2 7 13 18 23 29 34 39 3 10 17 25 31 38 5 14 22 33 42 11 26 37 9 27 1 21 6 35 30 41 19 15
18 36 54 13 32 51 11 31 52 14 35 57 20 42 5 28 53 19 44 9 38 4 33 2 30 3 37 8 43 17 50 27 10 48 29 16 59 47 40 26 24 23 25 39 46 58 15 49 21 6 1 12 45 41 7 34 22 56 55
1 3 6 10 7 5 9 8 4 2 11
20 40 2 23 44 7 29 51 15 38 4 28 53 19 46 13 41 10 37 9 39 12 45 18 52 27 3 42 22 58 43 26 11 56 48 34 31 25 24 30 33 47 55 8 35 5 49 21 17 36 1 54 6 57 50 16 14 32
3 8 7 2 4 5 1 6 9
2 4 6 8 10 12 14 16 18 20 22 24 26 28 3 7 11 15 19 23 27 5 13 21 1 17 9 25
6 12 18 24 30 36 42 48 4 11 19 26 33 40 47 5 14 22 31 39 49 8 17 28 38 50 10 23 35 46 13 27 43 7 25 44 15 34 3 32 9 41 21 16 2 20 37 29 1 45
20 9 30 21 12 4 28 23 17 14 11 10 13 16 22 27 3 18 1 24 8 7 19 31 26 2 29 25 6 5 15
7 14 21 8 16 3 12 1 11 2 15 6 20 18 17 19 5 13 4 9 10
6 12 18 24 30 36 42 48 1 8 15 22 29 37 44 51 5 14 23 32 40 49 4 16 26 35 46 3 17 28 41 53 13 31 45 9 25 43 10 33 52 21 50 27 7 39 34 20 38 2 47 19 11
4 8 12 16 20 24 28 32 36 40 44 48 2 7 13 18 23 29 34 39 45 50 6 14 21 27 35 42 49 9 17 26 37 46 5 19 31 43 10 25 41 11 33 3 38 22 15 30 1 47
15 30 5 21 37 13 31 8 26 4 24 3 25 7 29 12 36 20 9 35 23 16 6 40 38 34 39 2 14 22 1 27 18 19 33 32 17 11 28 10
7 2 6 3 5 4 1
3 6 9 12 15 2 7 11 16 5 13 4 14 10 1 8
6 12 18 24 30 2 9 16 23 31 4 13 21 29 5 15 26 1 14 27 7 20 34 19 3 25 11 8 33 10 22 17 32 28
11 22 3 15 27 9 23 6 20 5 21 8 26 14 2 25 17 12 7 4 10 16 24 1 29 30 19 13 18 28
20 40 18 39 19 42 23 4 28 10 35 21 6 33 22 9 41 31 25 15 12 8 7 11 14 24 30 38 16 36 26 5 3 17 34 29 37 32 27 2 1 13
9 18 27 7 17 28 10 21 3 15 29 13 26 14 2 20 8 1 23 19 16 22 25 6 4 5 24 11 12
4 3 7 2 1 6 5
4 8 12 16 20 24 28 32 36 40 44 1 6 11 17 22 27 33 38 43 2 9 15 23 30 37 45 5 14 25 34 42 7 19 31 46 13 29 47 21 41 26 10 3 18 39 35
3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 1 5 10 14 19 23 28 32 37 41 46 50 55 4 11 17 25 31 38 44 52 2 13 22 34 43 53 8 26 40 56 20 47 16 49 35 7 29
8 4 2 3 7 13 12 6 9 10 5 11 1
11 22 33 44 10 23 35 2 15 28 41 9 25 39 8 26 42 14 31 4 21 43 18 38 17 40 20 3 30 13 1 34 27 19 16 24 32 45 12 6 7 37 29 36 5
21 42 22 2 25 6 30 12 37 20 7 34 19 9 39 29 18 13 5 1 40 38 41 4 11 17 28 3 24 8 32 27 31 36 23 16 35 10 14 33 15 26
12 24 8 21 6 20 7 23 11 28 17 9 1 22 16 14 13 15 19 27 5 2 26 4 3 25 18 10
4 8 12 16 20 24 28 32 36 40 44 48 2 7 13 18 23 29 34 39 45 50 6 14 21 27 35 42 49 9 17 26 37 46 5 19 31 43 10 25 41 11 33 3 38 22 15 30 1 47
17 34 15 33 16 36 20 4 25 10 32 22 9 1 27 19 12 7 5 3 6 11 18 26 35 23 8 31 2 21 13 24 28 30 14 29
17 1 19 4 23 9 29 16 6 28 20 11 3 31 26 24 22 25 30 2 10 18 7 27 15 21 5 32 8 12 14 33 13
```

## Ranking

### Ruby_

RankUserSizeTimeDateStatistics
1leonid690.09382011/06/25 07:56:080B / 29B / 36B
2uru740.21222011/06/26 03:24:320B / 33B / 38B

### Perl_

RankUserSizeTimeDateStatistics
1teebee580.44192011/06/24 08:51:330B / 22B / 34B
2tails640.46552011/06/24 09:49:580B / 27B / 34B
3Hem650.33492011/06/29 14:27:261B / 20B / 41B
4Terje K580.02512011/07/13 16:31:590B / 23B / 33B

### Python_

RankUserSizeTimeDateStatistics
1leonid970.37062011/06/25 07:53:130B / 59B / 37B
2hallvabo1000.42662011/06/25 06:09:340B / 59B / 40B

### Arc_

RankUserSizeTimeDateStatistics
1youz1044.31032011/07/08 09:38:160B / 51B / 43B

### Io_

RankUserSizeTimeDateStatistics
1pooq1762.26792011/06/28 03:27:470B / 122B / 41B

### JavaScript_

RankUserSizeTimeDateStatistics
1nn1050.19002011/07/07 14:51:210B / 53B / 50B
2nn1020.17582011/07/10 01:08:240B / 47B / 53B

### BASIC_

RankUserSizeTimeDateStatistics
1pooq1430.09972011/06/27 16:40:430B / 79B / 55B

### J_

RankUserSizeTimeDateStatistics
1I., S.460.10512011/07/02 20:23:320B / 14B / 31B
2pooq811.75102011/06/26 08:42:380B / 30B / 43B
3I., S.(post mortem method)430.35952011/07/08 22:22:540B / 15B / 27B
4I., S.(pooq)540.08492011/07/11 01:12:170B / 16B / 35B

### C_

RankUserSizeTimeDateStatistics
1inaniwa1100.06162011/06/30 08:28:590B / 51B / 58B
2nn1110.02932011/06/30 14:04:370B / 46B / 64B
33011160.03362011/06/26 17:44:020B / 58B / 58B
4uru1160.04102011/06/30 23:38:360B / 56B / 60B
5koi1260.04102011/06/26 02:45:160B / 62B / 63B
6not1270.04332011/06/25 05:46:130B / 64B / 63B
7kou1380.03932011/06/25 22:17:020B / 66B / 72B
8nn1080.00422011/07/10 03:16:550B / 49B / 58B

RankUserSizeTimeDateStatistics
1notogawa1210.22692011/06/25 14:05:130B / 69B / 48B

### Java_

RankUserSizeTimeDateStatistics
1teebee2210.56882011/06/27 22:10:340B / 125B / 88B

### Pascal_

RankUserSizeTimeDateStatistics
1uru1450.04592011/06/30 22:26:510B / 88B / 39B

### Maxima_

RankUserSizeTimeDateStatistics
1pooq1720.90252011/06/27 13:29:120B / 85B / 85B

### AWK_

RankUserSizeTimeDateStatistics
1I., S.910.49412011/06/28 07:14:060B / 40B / 49B

### bc_

RankUserSizeTimeDateStatistics
1teebee1100.99852011/07/04 16:09:230B / 46B / 62B

### z80_

RankUserSizeTimeDateStatistics
1*yuko*710.17172011/07/08 01:56:3339B / 13B / 15B
2*yuko*700.17412011/08/06 03:24:4639B / 13B / 14B

### goruby_

RankUserSizeTimeDateStatistics
1leonid560.15042011/06/28 00:37:060B / 21B / 32B
2murky-satyr610.20132011/06/26 03:36:420B / 22B / 36B

### Groovy_

RankUserSizeTimeDateStatistics
1nn1105.64432011/07/07 14:16:310B / 60B / 48B
2murky-satyr1136.29822011/07/07 04:17:380B / 55B / 55B

### Language Ranking_

RankLangUserSizeScore
1JI., S.(post mortem method)4310000
2gorubyleonid567678
3Perlteebee587413
4Rubyleonid696231
5z80*yuko*706142
6AWKI., S.914725
7Pythonleonid974432
8JavaScriptnn1024215
9Arcyouz1044134
10Cnn1083981
11bcteebee1103909
12Groovynn1103909