Speed is everything

A positive integer p p is called almost prime , when it has only 1 divisor aside from 1 and p p . Find the sum of the 6 smallest almost primes.

See part 3 here ; see part 5 here .


The answer is 377.

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.

8 solutions

Josh Banister
Feb 8, 2015

Let's say that x x is an almostprime so it has 3 divisors. If we write x as the product of it's prime factors, it will be x = p 1 n 1 p 2 n 2 p 3 n 3 x = p_1 ^{n_1} p_2^{n_2} p_3^{n_3} \ldots where p i p_i is a unique prime and n i n_i is natural. If x x is the product of 2 or more unique primes then it will have factors 1 , p 1 , p 2 , p 1 p 2 1, p_1, p_2, p_1 p_2 \ldots . However, this means it will have more than 3 factors so it is not almost prime so therefore x x is a power of a single prime. The only power this will work for is p 2 p^2 where p p is prime because it will have 3 factors 1 , p , p 2 1, p, p^2 . Hence, x x is almostprime iff x = p 2 x = p^2 for prime p p

The sum of the first 6 almost primes is 2 2 + 3 2 + 5 2 + 7 2 + 1 1 2 + 1 3 2 = 337 2^2 + 3^2 + 5^2 + 7^2 + 11^2 + 13^2 = \boxed{337}

Mj Santos
Feb 7, 2015

Note that the 6 smallest value of almost prime (p) numbers are the squares of the 6 smallest prime numbers (which are 2,3,5,7,11,13). Therefore the sum is: 2 2 + 3 2 + 5 2 + 7 2 + 1 1 2 + 1 3 2 = 4 + 9 + 25 + 49 + 121 + 169 = 377 2^2+3^2+5^2+7^2+11^2+13^2=4+9+25+49+121+169=\boxed{377}

Moderator note:

This solution is incomplete. You fail to show why it must be in the form of a square of a prime number.

Hey. What about 8? 8=1x2³ and 27?

Yingxu Mu - 6 years, 4 months ago

Log in to reply

8 has 4 divisors (1,2,4,8) and not an almost prime number

MJ Santos - 6 years, 4 months ago
Gari Chua
Feb 8, 2015

Being almostprime means that the number has only three divisors, and the only possible way for that configuration is when the number is the square of a prime. Thus, the sum of the 6 smallest almostprime numbers is 2^2+3^2+5^2+7^2+11^2+13^2=377

Moderator note:

Your solution is not entirely clear. Why must "the only possible way for that configuration is when the number is the square of a prime"?

2x2+2x3+2x5+2x7+3x3+3x5=58 , according to definition given in question

naveen kumar - 6 years, 3 months ago

Log in to reply

No, dude.

Sure, 4 has three factors (1, 2, and 4), but 6 has four factors (1, 2, 3, and 6), and so are the other cases you mentioned, excluding the squares of primes. :)

Also, take note that the number of factors can be computed using the powers of it's primes. So 4 = 2^2, which means it has (2 + 1) -> 3 factors. With the other cases, you can see that ab (with a and b being prime numbers) has (1 + 1)(1 + 1) -> 2 * 2 -> 4 factors, which is not what we wanted.

Joeie Christian Santana - 6 years, 3 months ago

Log in to reply

yeah bro..

Jay-r Sartre - 6 years, 3 months ago
Mikako Onozaka
Mar 26, 2016

In order for a number to be an almost prime, it must have only one other divisor other than 1 or itself.

This means that the other divisor must be a prime, for otherwise the candidate number would also be divisible by the divisors of that divisor. For example, 4 is an almost prime because its divisors are 1, 2, and 4. Note that 2 is a prime number. However, 8 is not an almost prime, because its divisors are 1, 2, 4, and 8. 4 is not a prime number, so it is divisible by 2, and thus 8 is also divisible by 2, making it not almost prime.

Furthermore, the almost prime has to be a square of a prime number, because there can be no other divisors. For example, 6 is not an almost prime, because even though its other divisors are primes, (2 and 3) only one other divisor is allowed in the definition of an almost prime.

Thus, the sum of the 6 smallest almost primes are 2^2 + 3^2 + 5^2 + 7^2 + 11^2 + 13^2 = 4+9+25+49+121+169 = 377

Brock Brown
Feb 9, 2015

Python:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
def almost_p(n):
    divisors = 2
    for i in xrange(2,n):
        if n % i == 0:
            divisors += 1
    return divisors == 3
test = 0
count = 0
total = 0
while count < 6:
    if almost_p(test):
        count += 1
        total += test
    test += 1
print "Answer:", total

Moderator note:

This problem does not need computational aid.

The answer will be 377 377 . Since the numbers that are almost prime are the square of prime numbers. So, 2 2 + 3 2 + 5 2 + 7 2 + 1 1 2 + 1 3 2 = 377 2^2+3^2+5^2+7^2+11^2+13^2=377

Ramiel To-ong
Dec 4, 2015

nice problem

Leandro Silva
Jul 22, 2015

Any number will have just three divisor only if it is a square of a prime number. So this sum will be : 2 2 + 3 2 + 5 2 + 7 2 + 1 1 2 + 1 3 2 2^{2} + 3^{2} + 5^{2}+7^{2}+11^{2}+13^{2}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...