mersenneforum.org  

Go Back   mersenneforum.org > Fun Stuff > Puzzles

Reply
 
Thread Tools
Old 2012-02-28, 22:08   #23
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by lavalamp View Post
It doesn't affect the answer, but it sure as hell affects the run time.

By a factor of millions.

Edit: Or at least it does for the much larger range required by the problem.
my code works for 0,100 but doesn't give the suggest answer for 100,10000 is all I was trying to say.
science_man_88 is offline   Reply With Quote
Old 2012-02-28, 22:12   #24
lavalamp
 
lavalamp's Avatar
 
Oct 2007
Manchester, UK

5×271 Posts
Default

See my second edit.
lavalamp is offline   Reply With Quote
Old 2012-02-28, 23:56   #25
voidme
 
Feb 2012

67 Posts
Default

hard part is that even if you loop over x you have to be able to know, from x alone, how many ways there are to count whole number solutions between oddnumbered ranges
voidme is offline   Reply With Quote
Old 2012-02-29, 00:07   #26
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

20C016 Posts
Default

Quote:
Originally Posted by voidme View Post
hard part is that even if you loop over x you have to be able to know, from x alone, how many ways there are to count whole number solutions between oddnumbered ranges
looking at my prints lately in my code the easy part is:

1:odd
x:x*odd

but then there's still more of them. and that for me is the hard part to code I think. marking all odd numbers * a number not that hard I would think.
science_man_88 is offline   Reply With Quote
Old 2012-02-29, 13:33   #27
PdB
 
Feb 2012

11 Posts
Default Damned !

I found 301450082318808111, but it gets the red cross... can any solver tell me how close (or far...) I am ? Thanks
PdB is offline   Reply With Quote
Old 2012-02-29, 15:21   #28
voidme
 
Feb 2012

67 Posts
Default

not sure

my method takes a long time but that seems like its in the right ballpark

what im doing is iterating from M to N and trying to be able to automatically count the lattice points that fall between the two bounds all the way up but i have no idea how to count lattice points automatically

for ex, floor(y/x)^2 is odd when

odd number <= (y/x)^2 < even number
x*sqrt(odd number) <= y < x*sqrt(even number)

so these bounds will extend as far as they can until you start to exceed N. somehow there should be a way to look at these bounds and know how many lattice points will exist in that segment but idk
voidme is offline   Reply With Quote
Old 2012-03-01, 00:00   #29
lavalamp
 
lavalamp's Avatar
 
Oct 2007
Manchester, UK

135510 Posts
Default

Quote:
Originally Posted by PdB View Post
I found 301450082318808111, but it gets the red cross... can any solver tell me how close (or far...) I am ? Thanks
Remember what I said to SM88 before.

Quote:
Originally Posted by lavalamp View Post
Edit 2: Just noticed that you get the wrong answer because you're running the loop from 100 instead of 101. The problem specifies M < x <= N.
lavalamp is offline   Reply With Quote
Old 2012-03-01, 00:20   #30
voidme
 
Feb 2012

4316 Posts
Default

is there a much faster way to do it than my logic? I am hitting a wall here
voidme is offline   Reply With Quote
Old 2012-03-01, 08:25   #31
PdB
 
Feb 2012

B16 Posts
Default

@lavalamp : unfotunately, I did well start at 2e6+1.

@voidme : another path might be to compute triangles surfaces... N and M are so huge that maybye the boundary effets (ceil & floor on y=x.sqrt(n) lines) will compensate. We'll see.
PdB is offline   Reply With Quote
Old 2012-03-01, 13:07   #32
PdB
 
Feb 2012

11 Posts
Default Very fast but still approx...

The triangles surfaces method is pretty fast : 2 seconds to get 301257385700605400. It is still a wrong answer, but it's close to my previous result, obtained with a completely different way. Which means I'm close to the goal... the question is whether this fast but approximative method can be refined. Not sure !
PdB is offline   Reply With Quote
Old 2012-03-01, 15:02   #33
ldesnogu
 
ldesnogu's Avatar
 
Jan 2008
France

55010 Posts
Default

Quote:
Originally Posted by PdB View Post
The triangles surfaces method is pretty fast : 2 seconds to get 301257385700605400. It is still a wrong answer, but it's close to my previous result, obtained with a completely different way. Which means I'm close to the goal... the question is whether this fast but approximative method can be refined. Not sure !
For the triangle surface to work, you'd have to compute not the geometric surface but the surface you'd obtain by rasterizing your triangle.
ldesnogu is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Project Euler jhs Puzzles 32 2021-01-19 04:05
Project Euler 486 lavalamp Puzzles 8 2015-02-04 14:28
Euler (6,2,5) details. Death Math 10 2011-08-03 13:49
Project Euler Mini-Geek Lounge 2 2009-10-23 17:19
Bernoulli and Euler numbers (Sam Wagstaff project) fivemack Factoring 4 2008-02-24 00:39

All times are UTC. The time now is 03:07.


Sat Jul 17 03:07:16 UTC 2021 up 50 days, 54 mins, 1 user, load averages: 1.34, 1.29, 1.30

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.