Problem 266
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
In particular don't post any code fragments or results.
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
-
MrDrake
- Posts: 8
- Joined: Fri Oct 16, 2009 2:44 am
Problem 266
This is annoying... I've got 232...442, but there must be one larger!
EDIT: Never mind... there must be something wrong with my code somewhere, but changing a variable gave me the right answer!
EDIT: Never mind... there must be something wrong with my code somewhere, but changing a variable gave me the right answer!
-
sivakd
- Posts: 217
- Joined: Fri Jul 17, 2009 9:37 am
- Location: California, USA
- Contact:
Re: Problem 266
Not sure if asking this question would give away too much info, can this be solved with just 64 bit integers or like BigInteger type data types are needed?

puzzle is a euphemism for lack of clarity
- jaap
- Posts: 588
- Joined: Tue Mar 25, 2008 3:57 pm
- Contact:
-
sivakd
- Posts: 217
- Joined: Fri Jul 17, 2009 9:37 am
- Location: California, USA
- Contact:
Re: Problem 266
Thanks jaap. I managed to solve this problem without requiring big ints.

puzzle is a euphemism for lack of clarity
-
JMW1994
- Posts: 43
- Joined: Sat Apr 09, 2011 11:35 pm
-
thundre
- Posts: 356
- Joined: Sun Mar 27, 2011 10:01 am
Re: Problem 266
p = 2 * 3 * 5 * 7 * 11 * ... * 181JMW1994 wrote:What does this exactly mean?Let p be the product of the primes below 190.

-
MYNick
- Posts: 3
- Joined: Sat Feb 28, 2015 10:16 am
problem 266
https://projecteuler.net/problem=266
Hey guys, im trying to solve problem 266 for a couple of days now. Im pretty sure my solution is correct but the result is big red x. So i think i might do something wrong and i didn't understand the question correctly.
The question is:
lets take num which equal to the product of the prime numbers until 190 (the product of 42 numbers).
Now we take the sum and make a square root out of it. Now i need to find a product of group of numbers from the primes list (the 42 primes). For example: the third, fifth and 10th numbers will be the product. And i need to find the one that is closest to the sqrt of the real number. BUT it must be the closest from below, i can not pass the sqrt.
In the end i mod this product by (10**16)
I tried it in serval ways and i have no idea why the result is wrong. Can some one confrim something for me?
For the primes number in 100 (25 primes) my result is: 9552415660183671 (after mod). can some one confirm please?
The problem with the examples in the question is that they all 1 prime product and not product of couple of primes. Would be helpfull if real example will be added.
Hey guys, im trying to solve problem 266 for a couple of days now. Im pretty sure my solution is correct but the result is big red x. So i think i might do something wrong and i didn't understand the question correctly.
The question is:
lets take num which equal to the product of the prime numbers until 190 (the product of 42 numbers).
Now we take the sum and make a square root out of it. Now i need to find a product of group of numbers from the primes list (the 42 primes). For example: the third, fifth and 10th numbers will be the product. And i need to find the one that is closest to the sqrt of the real number. BUT it must be the closest from below, i can not pass the sqrt.
In the end i mod this product by (10**16)
I tried it in serval ways and i have no idea why the result is wrong. Can some one confrim something for me?
For the primes number in 100 (25 primes) my result is: 9552415660183671 (after mod). can some one confirm please?
The problem with the examples in the question is that they all 1 prime product and not product of couple of primes. Would be helpfull if real example will be added.
-
DJohn
- Posts: 90
- Joined: Sat Oct 11, 2008 12:24 pm
Re: problem 266
Your description sounds right to me (except in "Now we take the sum and make a square root out of it", it's the product, not the sum). N is the product of the primes below 190 (a very large number). You need to find the largest s such that s divides N and s <= sqrt(N).
It's easy to check small values by brute force. For primes below 20, I get N = 9699690 and s = 3094. For primes below 50 (the largest N that fits in 64 bit integers), s = 783152070. For the primes below 100, my result looks nothing like yours. Mine is 10xxxxxxxxxxxxxx65.
It's easy to check small values by brute force. For primes below 20, I get N = 9699690 and s = 3094. For primes below 50 (the largest N that fits in 64 bit integers), s = 783152070. For the primes below 100, my result looks nothing like yours. Mine is 10xxxxxxxxxxxxxx65.
-
MYNick
- Posts: 3
- Joined: Sat Feb 28, 2015 10:16 am
Re: problem 266
for below 100 i received 15xxxxxxxxxxxxxx65 but i got the right reslt for 190 now. I didnt receive the same result like you for 50 and i found the problem with my code.DJohn wrote:Your description sounds right to me (except in "Now we take the sum and make a square root out of it", it's the product, not the sum). N is the product of the primes below 190 (a very large number). You need to find the largest s such that s divides N and s <= sqrt(N).
It's easy to check small values by brute force. For primes below 20, I get N = 9699690 and s = 3094. For primes below 50 (the largest N that fits in 64 bit integers), s = 783152070. For the primes below 100, my result looks nothing like yours. Mine is 10xxxxxxxxxxxxxx65.
I used sort in the wrong way in python.
I now solved it, thank you very much
-
v6ph1
- Posts: 134
- Joined: Mon Aug 25, 2014 7:14 pm
Re: problem 266
As 2*3*...*97 = 2.3 * 10^36 and therefore the square is around 1.5(18..) * 10^18, DJohn must have a typing mistake.MYNick wrote:for below 100 i received 15xxxxxxxxxxxxxx65

-
DJohn
- Posts: 90
- Joined: Sat Oct 11, 2008 12:24 pm
Re: problem 266
Yes, I don't know how that happened. I get 15xxxxxxxxxxxxxx65 too.v6ph1 wrote:DJohn must have a typing mistake.MYNick wrote:for below 100 i received 15xxxxxxxxxxxxxx65
I intended to give the value after the mod, but a) that doesn't start with 10 either, and b) I got the wrong number of digits. I'll just blame Friday afternoon.
-
square1001
- Posts: 27
- Joined: Tue Mar 15, 2016 2:58 am
- Location: Tokyo, Japan
- Contact:
Re: Problem 266
I got Wrong Answer in my program.
Let f(n) = (the answer where p = (product of primes below n) ). (after taking mod)
f(30) = 79534
f(50) = 783152070
f(70) = 2803119896185
f(100) = 840xxxxxxxxxx365 (16 digits)
f(150) = 60xxxxxxxxxx310 (15 digits)
f(190) = 884xxxxxxxxxx635 (16 digits)
What value is wrong?
Please tell me.
Let f(n) = (the answer where p = (product of primes below n) ). (after taking mod)
f(30) = 79534
f(50) = 783152070
f(70) = 2803119896185
f(100) = 840xxxxxxxxxx365 (16 digits)
f(150) = 60xxxxxxxxxx310 (15 digits)
f(190) = 884xxxxxxxxxx635 (16 digits)
What value is wrong?
Please tell me.

-
v6ph1
- Posts: 134
- Joined: Mon Aug 25, 2014 7:14 pm
Re: Problem 266
The two last ones are definitely wrong - Did you take care about the range of 64Bit integers?

-
square1001
- Posts: 27
- Joined: Tue Mar 15, 2016 2:58 am
- Location: Tokyo, Japan
- Contact:

