Problem 193

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
Dennen
Posts: 4
Joined: Tue May 13, 2008 2:00 am

P193 Hint on squarefree numbers

Post by Dennen »

Could I get a hint on problem 193 (find all square free numbers below 2^50). I've tried to come up with lots of solutions (combinatorics / dynamic programming / recurrenses) but nothing seems to be fast enough.
User avatar
rayfil
Administrator
Posts: 1412
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Hint on squarefree numbers

Post by rayfil »

Just do it as fast as you possibly can and then learn from the forum how you could do it faster.
When you assume something, you risk being wrong half the time.
Dennen
Posts: 4
Joined: Tue May 13, 2008 2:00 am

Re: Hint on squarefree numbers

Post by Dennen »

Well it's probably too slow to do within any reasonable time (about a day or so). Just wondered if anyone had any small hint.
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Hint on squarefree numbers

Post by daniel.is.fischer »

I'm afraid any hint would be too big.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
Dennen
Posts: 4
Joined: Tue May 13, 2008 2:00 am

Re: Hint on squarefree numbers

Post by Dennen »

Well, at least, should I continue on the same way as before? Or try to come up with something new? I've thinking about doing something with the primes below 2^25 but it stills gets too slow. I suppose I need to use some combinatorics, since the number of squarefree integers is pretty large (I cant "create" them)
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Hint on squarefree numbers

Post by daniel.is.fischer »

You could PM me an outline of your ideas and I'd look which are useful.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
Dennen
Posts: 4
Joined: Tue May 13, 2008 2:00 am

Re: Hint on squarefree numbers

Post by Dennen »

Thanks, Ima write them down as soon as I can and send them!
sedefcho
Posts: 4
Joined: Fri Mar 14, 2008 6:08 pm
Location: Sofia, Bulgaria

Problem 193

Post by sedefcho »

I am still far from solving problem 193 :?

But I hope it is OK to ask the following.

Can someone confirm that the count
of the squarefree numbers below
k = 40000000 (below 40 million) is 24317053.

And is the count of squarefree numbers
below k = 15000000 (below 15 million) 9118889 ?

Thanks in advance.
User avatar
stijn263
Posts: 1505
Joined: Sat Sep 15, 2007 11:57 pm
Location: Netherlands

Re: square free

Post by stijn263 »

I can confirm both of your findings, so your on the right track :-)
sedefcho
Posts: 4
Joined: Fri Mar 14, 2008 6:08 pm
Location: Sofia, Bulgaria

Re: square free

Post by sedefcho »

Thank you.
User avatar
Assato
Posts: 13
Joined: Sun Apr 19, 2009 4:21 pm

Re: Problem 193

Post by Assato »

My program gives the right answer for 4e7 and 15e6 (as posted above), as well as for some other small numbers I tested (and counted the number of squarefrees manually), but it doesn't work for 2^50...

can anyone confirm these?

652756723 for 2^30
668422917419 for 2^40

Thanks...
User avatar
Assato
Posts: 13
Joined: Sun Apr 19, 2009 4:21 pm

Re: Problem 193

Post by Assato »

Nevermind, it worked... turns out result was off by 1.
Can anyone still confirm the numbers above? Not sure what caused them to be off by 1 sometimes and sometimes not...

EDIT: I think I found it... The 2^30 was also off by 1 (652756722) right?
User avatar
Tommy137
Posts: 238
Joined: Sun Feb 24, 2008 6:02 pm
Location: Cologne, Germany
Contact:

Re: Problem 193

Post by Tommy137 »

Yes, 652756722 for 230 and 668422917419 for 240 are correct.
Image
axelbrz
Posts: 51
Joined: Mon Sep 08, 2008 5:34 am

Re: Problem 193

Post by axelbrz »

Hi, I got 652756722 for 230 and 668422917419 for 240 too, but I'm getting a wrong answer for 250.

Can anybody tell me if is 21389533354941 correct for 245?

Thanks!
"think(O(n))+O(n) sometimes is better than think(O(1))+O(1)"

Image
User avatar
stijn263
Posts: 1505
Joined: Sat Sep 15, 2007 11:57 pm
Location: Netherlands

Re: Problem 193

Post by stijn263 »

That's not what I get. Think about what could go wrong with your method for higher limits. Overflow? Or something else? Good luck!
axelbrz
Posts: 51
Joined: Mon Sep 08, 2008 5:34 am

Re: Problem 193

Post by axelbrz »

Yes! It was overflow! :)

Thank you!
"think(O(n))+O(n) sometimes is better than think(O(1))+O(1)"

Image
Post Reply