Skip to content

Instantly share code, notes, and snippets.

@buccolo
Created December 11, 2011 16:37
Show Gist options
  • Save buccolo/1461440 to your computer and use it in GitHub Desktop.
Save buccolo/1461440 to your computer and use it in GitHub Desktop.
Computes OrdP values
#!/usr/bin/ruby
if ARGV.length != 2
print "syntax: ./Ord prime number\n"
exit
end
number = ARGV[1].to_f
number_print = ARGV[1].to_f
prime = ARGV[0].to_f
i = 0
while ((number % prime == 0) and number != 0)
i = i + 1
number = number / prime
end
print "Ord #{prime} (#{number_print}) = #{i}\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment