Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A128529
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A128529 Survivor of the Josephus problem, counting direction reversed after each step. +0
1
1, 1, 1, 1, 3, 4, 1, 3, 5, 1, 9, 8, 3, 3, 11, 1, 15, 7, 7, 18, 19, 16, 3, 7, 15, 24, 25, 18, 9, 28, 19, 24, 7, 13, 21, 5, 31, 20, 11, 15, 21, 32, 3, 11, 31, 7, 39, 23, 25, 15, 35, 1, 47, 32, 15, 54, 55, 48, 9, 19, 39, 60, 59, 58, 63, 7, 49, 50, 11, 40, 27, 70, 63, 48, 23, 27, 47, 74, 67 (list; graph; listen)
OFFSET

1,5

COMMENT

As in A007495, counting for elimination starts clockwise for the first elimination, then continues counter-clockwise from the eliminated place for the second, then toggles again to clockwise for the third elimination and changes direction in that manner after each elimination. Sequence shows original place of the survivor.

EXAMPLE

n=5 start with 1,2,3,4,5, count upwards to eliminate 5: 1,2,3,4. Count backwards

from 4 over 3 over 2 over 1 to eliminate 4: 1,2,3. Then count forwards from 1

(wrapping around and upwards of 4) over 2 etc. to eliminate 2: 1,3. Count backwards

starting at 1 (left of eliminated 2) to eliminate 1 and to leave a(5)=3.

MAPLE

a := proc(n) local l, dir, pos, i, c ; dir := 1 ; pos := 0 ; l := [seq(i, i=1..n)] ; for i from 1 to n-1 do pos := pos+n*dir ; pos := 1+((pos-1) mod nops(l)) ; l := subsop(pos=NULL, l) ; dir := -dir ; if dir > 0 then pos := pos-1 ; fi ; od ; RETURN(op(1, l)) ; end: for n from 1 to 85 do printf("%d, ", a(n)) ; od;

CROSSREFS

Cf. A007495, A128982.

Sequence in context: A117378 A088197 A087517 this_sequence A131228 A131129 A087694

Adjacent sequences: A128526 A128527 A128528 this_sequence A128530 A128531 A128532

KEYWORD

nonn

AUTHOR

R. J. Mathar (mathar(AT)strw.leidenuniv.nl), May 07 2007

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified December 20 00:58 EST 2009. Contains 171054 sequences.


AT&T Labs Research