SHARE
TWEET

Untitled

a guest Feb 21st, 2013 19 Never
  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
RAW Paste Data
Top