示例#1
0
def prime_numbers(offset = 1):
    number = request.args.get('number', None)
    if offset == 1 and number is not None:
        offset = int(number)
    prime_numbers = get_prime_numbers(int(offset), 1000)
    next_ = prime_numbers[-1] + 1
    end = prime_numbers[-1]
    return render_template ('numbers.html', end = end, next_=next_, limit=limit, offset=offset , numbers=prime_numbers)
示例#2
0
 def test_1000000_to_1004_are_prime(self):
     for number in get_prime_numbers(1000000,1004):
         self.assertTrue(is_prime_number(number))
示例#3
0
 def test_5_to_9_are_prime(self):
     for number in get_prime_numbers(5,9):
         self.assertTrue(is_prime_number(number))
示例#4
0
 def test_1_to_4_are_prime(self):
     for number in get_prime_numbers(1,4):
         self.assertTrue(is_prime_number(number))
示例#5
0
 def test_limit_10000(self):
     self.assertEqual(len(get_prime_numbers(10000,10000)),10000)
示例#6
0
 def test_limit_234(self):
     self.assertEqual(len(get_prime_numbers(1, 234)), 234)