gcd.rb:4 def gcd(a, b) # # ******************************************************** # # This tests the 'list' command. # # ******************************************************** # set basename on basename is on. # list [-1, 8] in gcd.rb 1 #!/usr/bin/env ruby 2 3 # GCD. We assume positive numbers => 4 def gcd(a, b) 5 # Make: a <= b 6 if a > b 7 a, b = [b, a] 8 end # list [9, 18] in gcd.rb 9 10 return nil if a <= 0 11 12 if a == 1 or b-a == 0 13 return a 14 end 15 return gcd(b-a, a) 16 end 17 18 gcd(3,5) # list [9, 18] in gcd.rb 9 10 return nil if a <= 0 11 12 if a == 1 or b-a == 0 13 return a 14 end 15 return gcd(b-a, a) 16 end 17 18 gcd(3,5) # list [9, 18] in gcd.rb 9 10 return nil if a <= 0 11 12 if a == 1 or b-a == 0 13 return a 14 end 15 return gcd(b-a, a) 16 end 17 18 gcd(3,5) # list - [-1, 8] in gcd.rb 1 #!/usr/bin/env ruby 2 3 # GCD. We assume positive numbers => 4 def gcd(a, b) 5 # Make: a <= b 6 if a > b 7 a, b = [b, a] 8 end # list - [-1, 8] in gcd.rb 1 #!/usr/bin/env ruby 2 3 # GCD. We assume positive numbers => 4 def gcd(a, b) 5 # Make: a <= b 6 if a > b 7 a, b = [b, a] 8 end # list - [-1, 8] in gcd.rb 1 #!/usr/bin/env ruby 2 3 # GCD. We assume positive numbers => 4 def gcd(a, b) 5 # Make: a <= b 6 if a > b 7 a, b = [b, a] 8 end # list - [-1, 8] in gcd.rb 1 #!/usr/bin/env ruby 2 3 # GCD. We assume positive numbers => 4 def gcd(a, b) 5 # Make: a <= b 6 if a > b 7 a, b = [b, a] 8 end # list 1 [-4, 5] in gcd.rb 1 #!/usr/bin/env ruby 2 3 # GCD. We assume positive numbers => 4 def gcd(a, b) 5 # Make: a <= b # list 20 [15, 18] in gcd.rb 15 return gcd(b-a, a) 16 end 17 18 gcd(3,5) # set listsize 5 Number of source lines to list by default is 5. # list 5 [3, 7] in gcd.rb 3 # GCD. We assume positive numbers => 4 def gcd(a, b) 5 # Make: a <= b 6 if a > b 7 a, b = [b, a] # list = [2, 6] in gcd.rb 2 3 # GCD. We assume positive numbers => 4 def gcd(a, b) 5 # Make: a <= b 6 if a > b # list 3-4 [3, 4] in gcd.rb 3 # GCD. We assume positive numbers => 4 def gcd(a, b) #