Skip to content

Instantly share code, notes, and snippets.

View Stamanos's full-sized avatar
🌍
Smiling

Manos Stamatakis Stamanos

🌍
Smiling
View GitHub Profile
@Stamanos
Stamanos / gist:b7eb60820fbb8640038ab25ae31d592a
Created August 4, 2017 16:09
Choose a random number, test it if is prime with the Miller-Rabin algorithm and if not, choose another randomly till find one.
import sys
import random
import os
#Εισαγωγή Μ bits
M = int(input("Παρακαλώ εισάγετε τα Bits > 1: "))
DoNotFound = True #Λογική μεταβλητή που μας δείχνει αν βρέθηκε πρώτος ή όχι
while DoNotFound: #Ο βρόγχος δεν θα σταματήσει μέχρι να βρει έναν πρώτο αριθμό
DoNotFound = False #Έστω πως ο αριθμός που θα διαλεχτεί τυχαία είναι πρώτος, μέχρι να αποδειχτεί το αντίθετο