Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror

Slashdot videos: Now with more Slashdot!

  • View

  • Discuss

  • Share

We've improved Slashdot's video section; now you can view our video interviews, product close-ups and site visits with all the usual Slashdot options to comment, share, etc. No more walled garden! It's a work in progress -- we hope you'll check it out (Learn more about the recent updates).

×
User Journal

dcowart's Journal: A086865 solution in python

Journal by dcowart

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.

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

A086865 solution in python

Comments Filter:

Simplicity does not precede complexity, but follows it.

Working...