Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ challenge

Name: fizzy and buzzy 2015-01-16 17:53

write a program which *grabs dick* for every prime number

Name: Anonymous 2015-01-16 18:21

#!/usr/bin/python

import random

def is_prime(n):
if n < 3:
return n > 1
if n % 2 == 0:
return False
s, d = 0, n - 1
while True:
q, r = divmod(d, 2)
if r == 1:
break
s, d = s + 1, q
for i in range(5):
a = random.randrange(2, n)
if pow(a, d, n) == 1:
continue
for i in range(s):
if pow(a, 2**i * d, n) == n - 1:
break
else:
return False
return True

if __name__ == '__main__':
n = 1
while True:
print "*grabs dick*" if is_prime(n) else n
n += 1

Name: Anonymous 2015-01-16 20:02

@echo off
:muhdik
echo *grabs dick*
goto :muhdik
rem There are infinite prime numbers, and this program *grabs dick* infinite times.

Name: Anonymous 2015-01-16 20:53

>>2
if __name__ == '__main__':
Terrible!

Name: Anonymous 2015-01-16 21:53

>>4
Welcome to the field, newbie programmer. As you gain experience you'll start to see the advantages of idiomatic code.

Name: Anonymous 2015-01-16 21:57

>>5
...advantages of idiotic code.

Name: Anonymous 2015-01-17 2:54

>>3
infinity is a jewish scam, much like set theory

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List