Beta

# Slashdot: News for Nerds

×

### Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

# A086865 solution in python

#### dcowart (13321) writes | more than 6 years ago

0

OEIS A086865 in python

import math

OEIS A086865 in python

import math

def isprime(possprime):
"""returns t/f if number is prime or not"""
for x in range(2, int(possprime/2)+1):
if possprime % x == 0:
return False
else:
return True

n = 0

while n < 10:
pp = 2 * math.pow(10,n) + 11
print "Working on ", n
if isprime(pp):
print n, " gives ", pp, " which is prime."
n=n+1

Works for python up to n = 8. Then runs out of memory :-( Just means I have to rewrite it in C.

cancel ×

Slashdot Account

Need an Account?

Don't worry, we never post anything without your permission.

# Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

• b
• i
• p
• br
• a
• ol
• ul
• li
• dl
• dt
• dd
• em
• strong
• tt
• blockquote
• div
• quote
• ecode

### "ecode" can be used for code snippets, for example:

``<ecode>    while(1) { do_something(); } </ecode>``
Create a Slashdot Account