fork download
  1. #!/usr/bin/perl
  2. use 5.016;
  3. use warnings;
  4.  
  5. sub gcd { $_[1] ? gcd($_[1], $_[0] % $_[1]) : $_[0] }
  6.  
  7. sub step { map{ [$_[0] * $_ / $_[2], $_[1] * $_ / $_[2]] } (0 .. $_[2]) }
  8.  
  9. sub f { step($_[0], $_[1], gcd(abs $_[0], abs $_[1])) }
  10.  
  11. say join("\n", map{ "@{$_}" } f(54, 66));
  12.  
Success #stdin #stdout 0s 3692KB
stdin
Standard input is empty
stdout
0 0
9 11
18 22
27 33
36 44
45 55
54 66