[#404611] Looking for Rubyists interested in P2P and privacy — Tony Arcieri <tony.arcieri@...>
Hey there, excuse the spam ;) Hopefully this is relevant enough.
3 messages
2013/08/07
[#409331] Capture HTML table data, pass to Ruby, pass back and display result in HTML text field — Hubert Wagner <lists@...>
Hello :
11 messages
2013/08/04
[#409339] Re: Capture HTML table data, pass to Ruby, pass back and display result in HTML text field
— Hubert Wagner <lists@...>
2013/08/04
Hello Jesus :
[#409340] Re: Capture HTML table data, pass to Ruby, pass back and display result in HTML text field
— Hassan Schroeder <hassan.schroeder@...>
2013/08/04
On Sun, Aug 4, 2013 at 9:18 AM, Hubert Wagner <lists@ruby-forum.com> wrote:
[#409346] Re: Capture HTML table data, pass to Ruby, pass back and display result in HTML text field
— Hubert Wagner <lists@...>
2013/08/04
Thank you all for your assistance (and patience).
[#409336] Rakefile Error - Please Help — "Jennifer T." <lists@...>
Hi,
13 messages
2013/08/04
[#409341] Re: Rakefile Error - Please Help
— Hassan Schroeder <hassan.schroeder@...>
2013/08/04
On Sun, Aug 4, 2013 at 7:41 AM, Jennifer T. <lists@ruby-forum.com> wrote:
[#409349] Re: Rakefile Error - Please Help
— "Jennifer T." <lists@...>
2013/08/04
Hassan Schroeder wrote in post #1117692:
[#409350] Re: Rakefile Error - Please Help
— Hassan Schroeder <hassan.schroeder@...>
2013/08/04
On Sun, Aug 4, 2013 at 1:42 PM, Jennifer T. <lists@ruby-forum.com> wrote:
[#409351] Re: Rakefile Error - Please Help
— "Jennifer T." <lists@...>
2013/08/04
Hassan Schroeder wrote in post #1117715:
[#409356] Re: Rakefile Error - Please Help
— Hassan Schroeder <hassan.schroeder@...>
2013/08/04
On Sun, Aug 4, 2013 at 2:21 PM, Jennifer T. <lists@ruby-forum.com> wrote:
[#409357] Re: Rakefile Error - Please Help
— "Jennifer T." <lists@...>
2013/08/04
Hassan Schroeder wrote in post #1117723:
[#409358] Re: Rakefile Error - Please Help
— Hassan Schroeder <hassan.schroeder@...>
2013/08/05
On Sun, Aug 4, 2013 at 4:57 PM, Jennifer T. <lists@ruby-forum.com> wrote:
Re: Faster primality testing and factorization methods in Ruby
From:
"Jabari Z." <lists@...>
Date:
2013-08-01 19:38:26 UTC
List:
ruby-talk #409289
I changed the Miller-Rabin in the gist to a shorter/faster/adjustable
version which I modified a little. Here's the new code in the gist.
------------------------------------------------------------------------
class Integer
# Miller-Rabin prime test in Ruby
# From: http://en.wikipedia.org/wiki/Miller-Rabin_primality_test
# Ruby Rosetta Code:
http://rosettacode.org/wiki/Miller-Rabin_primality_test
# I modified the Rosetta Code, as shown below
require 'openssl'
def primemr?(k=20) # increase k for more reliability
n = self.abs
return true if n == 2 or n == 3
return false if n % 6 != 1 && n % 6 != 5 or n == 1
d = n - 1
s = 0
(d >>= 1; s += 1) while d & 1 == 0 # while d even
k.times do
a = 2 + rand(n-4)
x = OpenSSL::BN::new(a.to_s).mod_exp(d,n) #x = (a**d) % n
next if x == 1 or x == n-1
(s-1).times do
x = x.mod_exp(2,n) #x = (x**2) % n
return false if x == 1
break if x == n-1
end
return false if x != n-1
end
true # probably
end
end
--
Posted via http://www.ruby-forum.com/.