Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 21st, 2013  |  syntax: None  |  size: 0.23 KB  |  views: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. def order(n)
  2.   i=1
  3.   a=2
  4.   list=[]
  5.   until (i==n || a==n) do
  6.           puts "a=#{a}, i=#{i}"
  7.     if (a**i).modulo(n)==1
  8.            
  9.       list << [a,i]
  10.       a+=1
  11.       i=1
  12.     else
  13.       i+=1
  14. end
  15.   end
  16.   return list
  17. end
clone this paste RAW Paste Data