Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
EnPy3 /
20121110aModulesWrite two programs:
In order to decide if a number is prime, you can use this simple function: def is_prime(n): """ Decide whether a number is prime or not. """ if n < 2: return False if n == 2: return True if n % 2 == 0: return False i = 3 maxi = n**0.5 + 1 while i <= maxi: if n % i == 0: return False i += 2 return True Further instructions will be given during the lab… The source code of the Miller-Rabin algorithm is here: miller_rabin.py. |
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |