October 27th, 2017 at 6:55:51 PM
permalink

Quote:gamerfreakIt looks like Wolfram Alpha uses the Rabin-Miller test: http://mathworld.wolfram.com/PrimalityTest.html

I'm not sure how they do it so fast on their engine. Maybe they have precalculated tables? There doesn't seem to be a limit to how many digits you can enter, though.

I am not sure, but I think it tries a "fast" method of some sort. I entered 9,223,372,036,854,775,783 (which is 2

October 31st, 2017 at 6:55:12 AM
permalink

Prime challenge is still open (or any other if you can do better). It's a very difficult problem to solve once you get into big numbers.

A Pythagorean triplet is a set of three natural numbers where a < b < c, for which a^2 + b^2 = c^2

For example:

3^2 + 4^2 = 9 + 16 = 25 = 5^2.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.

Find the product abc.

For example:

3^2 + 4^2 = 9 + 16 = 25 = 5^2.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.

Find the product abc.

Last edited by: gamerfreak on Oct 31, 2017

October 31st, 2017 at 8:00:52 AM
permalink

Bruh, you should write x^2 instead of x2. Makes comprehending this much easier....assuming that's what you mean.

Is this the proper interpretation of the "For example:"

3^2 + 4^2 = 9 + 16 = 25 and that's equal to 5^2 ?

ie: a, b, c = 3, 4, 5 respectively?

Also, should use QUOTE or even SPOILER instead of CODE, because on some of the challenges you have to scroll right to read rest of description.

Is this the proper interpretation of the "For example:"

3^2 + 4^2 = 9 + 16 = 25 and that's equal to 5^2 ?

ie: a, b, c = 3, 4, 5 respectively?

Also, should use QUOTE or even SPOILER instead of CODE, because on some of the challenges you have to scroll right to read rest of description.

00111100101100001011011100110101101100101011001010010000001101111011100110110001101100001011100100010000001101100011010010110110101100001001000000110111101110011011000110110000101110010

October 31st, 2017 at 8:09:02 AM
permalink

Quote:RSBruh, you should write x^2 instead of x2. Makes comprehending this much easier....assuming that's what you mean.

Is this the proper interpretation of the "For example:"

3^2 + 4^2 = 9 + 16 = 25 and that's equal to 5^2 ?

ie: a, b, c = 3, 4, 5 respectively?

Also, should use QUOTE or even SPOILER instead of CODE, because on some of the challenges you have to scroll right to read rest of description.

My bad, copy and paste got me on the squares, I edited.

And damn how small is your screen? I formatted so it even shows up on my phone without scrolling. BUT HAVE IT YOUR WAY, it's in a spoiler now.

October 31st, 2017 at 8:16:14 AM
permalink

I said SOME of the previous challenges, ie: challenge #1.

And putting it in CODE within a SPOILER doesn't halp. Obvii in this case it doesn't matter b/c he's not too long, width-wise. But the earlier ones would still be wonky.

And putting it in CODE within a SPOILER doesn't halp. Obvii in this case it doesn't matter b/c he's not too long, width-wise. But the earlier ones would still be wonky.

00111100101100001011011100110101101100101011001010010000001101111011100110110001101100001011100100010000001101100011010010110110101100001001000000110111101110011011000110110000101110010

October 31st, 2017 at 8:19:07 AM
permalink

Quote:RSI said SOME of the previous challenges, ie: challenge #1.

And putting it in CODE within a SPOILER doesn't halp. Obvii in this case it doesn't matter b/c he's not too long, width-wise. But the earlier ones would still be wonky.

It's all fixed and I'll do it that way from now on. Now go solve it.

October 31st, 2017 at 9:58:39 AM
permalink

a=200

b=375

c=425

a*b*c=31875000

public class FindPythagoreanTriplets {

public static void main(String[] args) {

new FindPythagoreanTriplets();

}

public FindPythagoreanTriplets() {

boolean solutionFound = false;

int a = 3;

int b = 0;

int c = 0;

while (1000 % (a + b + c) >0) {

a++;

if (a % 2 == 0) // even

{

b = a * a / 4 - 1;

c = b + 2;

} else {

b = (a * a - 1) / 2;

c = b + 1;

}

}

int mult = 1000 / (a + b + c);

a *= mult;

b *= mult;

c *= mult;

System.out.println(a + " " + b + " " + c + " " + a * b * c);

}

}

I heart Crystal Math.

October 31st, 2017 at 10:01:13 AM
permalink

Quote:gamerfreakPrime challenge is still open (or any other if you can do better). It's a very difficult problem to solve once you get into big numbers.

A Pythagorean triplet is a set of three natural numbers where a < b < c, for which a^2 + b^2 = c^2

For example:

3^2 + 4^2 = 9 + 16 = 25 = 5^2.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.

Find the product abc.

Sometimes, just some good old-fashioned math will do.

C = 1000 - (A + B)

A^2 + B^2 = C^2 = (1000 - (A + B))^2

A^2 + B^2 = 1,000,000 - 2000 A - 2000 B + A^2 + 2AB + B^2

0 = 1,000,000 - 2000 A - 2000 B + 2AB

1000 A + 1000 B = 500,000 + AB

This means AB is a multiple of 1000

1000 B - AB = 500,000 - 1000 A

B = (500,000 - 1000 A) / (1000 - A)

= 1000 (500 - A) / (1000 - A)

= 1000 ((1000 - A) - 500) / (1000 - A)

= 1000 - 500,000 / (1000 - A)

(1000 - A) must be a factor of 500,000

Also, 500,000 / (1000 - A) < 1000, as otherwise B <= 0

This means 500,000 < 1,000,000 - 1000 A

1000 A < 500,000

A < 500

1000 - A > 500

The only integers between 500 and 1000 that are factors of 500,000 = 2^5 x 5^6 are 625 and 800

1000 - A = 625 -> A = 375 -> B = 200, but A < B is given

1000 - A = 800 -> A = 200 -> B = 375 -> C = 425

200^2 + 375^2 = 40,000 + 140,625 = 180,625 = 425^2 = (1000 - (200 + 375))^2

November 8th, 2017 at 8:48:15 AM
permalink

Quote:CrystalMath

a=200

b=375

c=425

a*b*c=31875000

public class FindPythagoreanTriplets {

public static void main(String[] args) {

new FindPythagoreanTriplets();

}

public FindPythagoreanTriplets() {

boolean solutionFound = false;

int a = 3;

int b = 0;

int c = 0;

while (1000 % (a + b + c) >0) {

a++;

if (a % 2 == 0) // even

{

b = a * a / 4 - 1;

c = b + 2;

} else {

b = (a * a - 1) / 2;

c = b + 1;

}

}

int mult = 1000 / (a + b + c);

a *= mult;

b *= mult;

c *= mult;

System.out.println(a + " " + b + " " + c + " " + a * b * c);

}

}

Correct answer. However I believe there is a more efficient solution using Primitive Triplets and Parametrization.

Quote:ThatDonGuyQuote:gamerfreakPrime challenge is still open (or any other if you can do better). It's a very difficult problem to solve once you get into big numbers.

A Pythagorean triplet is a set of three natural numbers where a < b < c, for which a^2 + b^2 = c^2

For example:

3^2 + 4^2 = 9 + 16 = 25 = 5^2.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.

Find the product abc.

Sometimes, just some good old-fashioned math will do.

C = 1000 - (A + B)

A^2 + B^2 = C^2 = (1000 - (A + B))^2

A^2 + B^2 = 1,000,000 - 2000 A - 2000 B + A^2 + 2AB + B^2

0 = 1,000,000 - 2000 A - 2000 B + 2AB

1000 A + 1000 B = 500,000 + AB

This means AB is a multiple of 1000

1000 B - AB = 500,000 - 1000 A

B = (500,000 - 1000 A) / (1000 - A)

= 1000 (500 - A) / (1000 - A)

= 1000 ((1000 - A) - 500) / (1000 - A)

= 1000 - 500,000 / (1000 - A)

(1000 - A) must be a factor of 500,000

Also, 500,000 / (1000 - A) < 1000, as otherwise B <= 0

This means 500,000 < 1,000,000 - 1000 A

1000 A < 500,000

A < 500

1000 - A > 500

The only integers between 500 and 1000 that are factors of 500,000 = 2^5 x 5^6 are 625 and 800

1000 - A = 625 -> A = 375 -> B = 200, but A < B is given

1000 - A = 800 -> A = 200 -> B = 375 -> C = 425

200^2 + 375^2 = 40,000 + 140,625 = 180,625 = 425^2 = (1000 - (200 + 375))^2

¯\_(ツ)_/¯

I can code but I'm terrible at math :(