Help for this page

Select Code to Download


  1. or download this
    sub f {
        my( $n, $g, $m ) = @_;
        $n % $g + $g * int(($m - $n) / $g);
    };;
    
  2. or download this
    [0] Perl> print join ' ', map f( $_, 8, 15 ), 0 .. 15;;
    8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7
    ...
    
    [0] Perl> print join ' ', map f( $_, 1, 23 ), 0 .. 23;;
    23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
    
  3. or download this
    [0] Perl> print join ' ', map f( $_, 9, 26 ), 0 .. 26;;
    18 19 20 21 22 23 24 25 26 9 10 11 12 13 14 15 16 17 0 1 2 3 4 5 6 7 8
    ...
    
    [0] Perl> print join ' ', map f( $_, 3, 26 ), 0 .. 26;;
    24 25 26 21 22 23 18 19 20 15 16 17 12 13 14 9 10 11 6 7 8 3 4 5 0 1 2