Problem 266

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
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.

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


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
Post Reply
MrDrake
Posts: 8
Joined: Fri Oct 16, 2009 2:44 am

Problem 266

Post by MrDrake »

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!
sivakd
Posts: 217
Joined: Fri Jul 17, 2009 9:37 am
Location: California, USA
Contact:

Re: Problem 266

Post by sivakd »

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?
Image
puzzle is a euphemism for lack of clarity
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 266

Post by jaap »

That's a false dichotomy.
sivakd
Posts: 217
Joined: Fri Jul 17, 2009 9:37 am
Location: California, USA
Contact:

Re: Problem 266

Post by sivakd »

Thanks jaap. I managed to solve this problem without requiring big ints.
Image
puzzle is a euphemism for lack of clarity
JMW1994
Posts: 43
Joined: Sat Apr 09, 2011 11:35 pm

Re: Problem 266

Post by JMW1994 »

What does this exactly mean?
Let p be the product of the primes below 190.
Image
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 266

Post by thundre »

JMW1994 wrote:What does this exactly mean?
Let p be the product of the primes below 190.
p = 2 * 3 * 5 * 7 * 11 * ... * 181
Image
JMW1994
Posts: 43
Joined: Sat Apr 09, 2011 11:35 pm

Re: Problem 266

Post by JMW1994 »

Thanks.
Image
MYNick
Posts: 3
Joined: Sat Feb 28, 2015 10:16 am

problem 266

Post by MYNick »

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.
DJohn
Posts: 90
Joined: Sat Oct 11, 2008 12:24 pm

Re: problem 266

Post by DJohn »

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.
MYNick
Posts: 3
Joined: Sat Feb 28, 2015 10:16 am

Re: problem 266

Post by MYNick »

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.
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.
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

Post by v6ph1 »

MYNick wrote:for below 100 i received 15xxxxxxxxxxxxxx65
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.
Image
DJohn
Posts: 90
Joined: Sat Oct 11, 2008 12:24 pm

Re: problem 266

Post by DJohn »

v6ph1 wrote:
MYNick wrote:for below 100 i received 15xxxxxxxxxxxxxx65
DJohn must have a typing mistake.
Yes, I don't know how that happened. I get 15xxxxxxxxxxxxxx65 too.

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

Post by square1001 »

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.
Image
v6ph1
Posts: 134
Joined: Mon Aug 25, 2014 7:14 pm

Re: Problem 266

Post by v6ph1 »

The two last ones are definitely wrong - Did you take care about the range of 64Bit integers?
Image
square1001
Posts: 27
Joined: Tue Mar 15, 2016 2:58 am
Location: Tokyo, Japan
Contact:

Re: Problem 266

Post by square1001 »

Thanks, v6ph1!
I realized that my code had been overflowed...
Finally I got AC :D
Image
Post Reply