# -*- coding: iso-8859-1 -*- # Autor: Klaus Merkert, Datum: 29.5.08 from time import * print 'Primzahltester (einfach)\n' n = input('n = ') t1 = clock() # ----------------------------------- Anfangszeit in s t = 0 i = 1 while i <= n: if n%i == 0: t = t+1 i = i+1 t2 = clock() # ----------------------------------- Endzeit in s dt = t2 - t1 # ---------- Zeitdifferenz = Endzeit - Anfangszeit if t == 2: print '\n'+str(n)+' ist eine Primzahl.' else: print '\n'+str(n)+' ist keine Primzahl.' print '\nRechenzeit: '+str(dt)+'s\n'