in reply to Re: Simple but thought-provoking programming tasks [OT]
in thread Simple but thought-provoking programming tasks [OT]

Like this?
my $N = 50; my $M = 4; my @a=(1..$N); my $x=-1; # because Perl arrays start at 0 while (@a) { $x = ($x+4) % scalar(@a); print splice(@a, $x--, 1), "\n" };

Replies are listed 'Best First'.
Re^3: Simple but thought-provoking programming tasks [OT]
by Krambambuli (Curate) on Apr 16, 2007 at 15:09 UTC
    Definitely a possible and nice solution! :)