Catch up on stories from the past week (and beyond) at the Slashdot story archive


Forgot your password?
Check out the new SourceForge HTML5 internet speed test! No Flash necessary and runs on all devices. ×
User Journal

Journal dcowart's Journal: A086865 solution in python

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
                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."

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

This discussion has been archived. No new comments can be posted.

A086865 solution in python

Comments Filter:

They are called computers simply because computation is the only significant job that has so far been given to them.