Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2020-11-17 15:54:56 +01:00
parent 7c64f509d9
commit fe3aaf4645
Signed by: y0rune
GPG Key ID: F204C385F57EB348

View File

@ -105,7 +105,7 @@ def primalityTest(n)
return true return true
end end
counter = 10000 counter = 50
#counter = SecureRandom.random_number(3..n) #counter = SecureRandom.random_number(3..n)
while (counter != 0) do while (counter != 0) do
b = SecureRandom.random_number(2..n-2) # Tez dziala n-1 b = SecureRandom.random_number(2..n-2) # Tez dziala n-1
@ -140,7 +140,7 @@ puts "Zadanie 1: " + random_gen_Zn(281796087963139763742863778538322230824167491
# n - liczba nalezaca do N # n - liczba nalezaca do N
puts "Zadanie 2: " + reciprocal_Phi_p(10,13).inspect puts "Zadanie 2: " + reciprocal_Phi_p(10,13).inspect
puts "Zadanie 2: " + reciprocal_Phi_p(814124120905749248299480415803476335639365723498296123469468592347073656928224527500310685973387246534780850320750411701278256916776754378412188178575147137091744859172404523278057868961064832876066462511095131108735875202132121424592704723, 9526498155551074622733236474497582527180243659164477550500224943978308908366162791700317474349020449651725045825391711253868497973855214826394160675701816160034393010008158121969738694286765731179652981990154532407906402992580840627870456203877142535098973).inspect puts "Zadanie 2: " + reciprocal_Phi_p(76638723687263876287368268368726378623873687326872634868374687236487623874687648634863847623846834687643,100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000961 ).inspect
################################################################################### ###################################################################################
@ -152,7 +152,7 @@ puts "Zadanie 2: " + reciprocal_Phi_p(814124120905749248299480415803476335639365
# Gdzie obliczna jest wartosc x^k mod n # Gdzie obliczna jest wartosc x^k mod n
puts "Zadanie 3: " + betterExponentiation(8,2,30).inspect puts "Zadanie 3: " + betterExponentiation(8,2,30).inspect
puts "Zadanie 3: " + betterExponentiation(814124120905749248299480415803476335639365723498296123469468592347073656928224527500310685973387246534780850320750411701278256916776754378412188178575147137091744859172404523278057868961064832876066462511095131108735875202132121424592704723, 9526498155551074622733236474497582527180243659164477550500224943978308908366162791700317474349020449651725045825391711253868497973855214826394160675701816160034393010008158121969738694286765731179652981990154532407906402992580840627870456203877142535098973, 814124120905749248299480415803476335639365723498296123469468592347073656928224527500310685973387246534780850320750411701278256916776754378412188178575147137091744859172404523278057868961064832876066462511095131108735875202132121424592704723321321312312312312321312312321).inspect puts "Zadanie 3: " + betterExponentiation(76638723687263876287368268368726378623873687326872634868374687236487623874687648634863847623846834687643, 76382637812836812638612836812638612376182263812623861283618723681263861238612386, 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000961).inspect
################################################################################### ###################################################################################
@ -191,6 +191,6 @@ puts "Zadanie 5: " + squareRootFp(15485863,2).inspect
# Gdzie n - liczba wejsciowa # Gdzie n - liczba wejsciowa
puts "Zadanie 6: " + primalityTest(13).inspect puts "Zadanie 6: " + primalityTest(13).inspect
puts "Zadanie 6: " + primalityTest(1000000016531).inspect puts "Zadanie 6: " + primalityTest(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000961).inspect
################################################################################### ###################################################################################