Smallest Positive Prime

Which is the smallest positive prime which is some multiple of seven less than a cube of a counting number less than ten ?


The answer is 7.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Bill Bell
Aug 2, 2015
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from gmpy2 import is_prime

smallest_prime=10**8
cubes=[n**3 for n in range(1,10)]
for cube in cubes:
    upper_k=1+cube/7
    for k in range(1,upper_k):
        possible_prime=cube-7*k
        if is_prime(possible_prime) and smallest_prime>possible_prime:
            smallest_prime=possible_prime
            associated_cube=cube
            associated_k=k
print smallest_prime

Vandit Kankariya
Mar 30, 2014

7^3 -(7 × 48) = 7

The wordings are quite a "lot" misleading. Why shan't I read it as "some multiple of ( n 3 7 n^3-7 )?

Satvik Golechha - 6 years, 10 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...