Support Forums
Generate Prime Numbers [Python] - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Python Programming Language (https://www.supportforums.net/forumdisplay.php?fid=32)
+---- Thread: Generate Prime Numbers [Python] (/showthread.php?tid=11005)



Generate Prime Numbers [Python] - wchar_t - 08-06-2010

Code:
num1 = #this is checked for primeness(or primeily, or primeilyness)
                   looper = 3                                                                           #sets vars
                   trigger = 0
                   num2 = 0
                   while trigger == 0:
                          
                           remain = num1%looper                    
                           if remain != 0:                                                                      #if remain = 0 then num1 is divisable by looper
                                   if looper == num1 - 1:
                                           if num1 == 4:                                                #4 breaks it(maybe)
                                                   meow = 0
          
                                           else:
                                                   num2 = num2 + 1                      
                                                   print num1                                                   #if num1 is printed then it is prime
                                                   trigger = 1
                                   looper = looper + 1
                                  
                           else:
                                   print "not prime"    
                                   trigger = 1

VictoireVictoireVictoire