Prime Problem

Suppose that A + B + C 2 = D \frac{A+B+C}{2}=D

Where A, B, C and D are prime numbers.

What is the smallest solution to D?


The answer is 3.

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

Chase Marangu
Apr 22, 2018
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Here is a JavaScript code I wrote
// because I originally thought to try 2, 3, and 5 which didn't work
// it tries all a b and c go from 1 to 10 which was enough

function isprime(n) {
    for (var i=2; i<100; ++i) {
        if (n%i===0) {
            if (n !== i) {
                return false;
            }
        }
    }
    if ((n < 2) || ((i%1) !== 0)) {
        return false;
    }
    return true;
};

var t = []; // since javascript allows "everything is a value" I can switch a array to a number
// and it will act as a flag and as the stored value
// don't worry I have no idea what I'm talking about I used to think all the programming
// languages worked the same because how they looked on the surface
// I'm still not a professional or anything

for (var a=2; a<10; ++a) {
    for (var b=2; b<10; ++b) {
        for (var c=2; c<10; ++c) {
            if (isprime(c)) {
                if (t instanceof Array) {
                    if(isprime((a+b+c)/2)) {
                        t = (a+b+c)/2;
                    }
                }
            }
        }
    }
}

console.log(t);
// Post Scriptum I actually wrote this in processing JS on Khan Academy but to make it more
// professional looking I translated it to pure javascript 

It has to be so big and obnoxious why can't it do the "read more" thing?

chase marangu - 3 years, 1 month ago

Log in to reply

@chase marangu IKR

chase marangu - 2 years, 9 months ago
X X
Apr 21, 2018

(2+2+2)/2=3

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...