mersenneforum.org searching part of the space using binary search
 Register FAQ Search Today's Posts Mark Forums Read

 2013-09-24, 05:53 #1 William Edwards   Sep 2013 1 Posts searching part of the space using binary search (I'm a rank hobbyist and I doubt my input is especially inspired, and I really just want to find out how useful the pattern I noticed is. Apologies aside:) I was looking at the part of the hyperbolic curve near the middle where the curve is very nearly diagonal, and noticed a simple, exploitable pattern: http://media.tumblr.com/2ecc00039204...acK1r3qp3f.png (You'll see that I chose to plot y going downwards, like a times-table.) Near the centre of the curve those squares go diagonally for some long run and then take one step downwards. This is because the curve is slightly greater than 45o, obviously. And if (x+1)*(y-1) < target, then x*y must also be less than target. You are only interested in finding and evaluating where it goes down one. So you can travel those diagonals using a binary search or by division. Here is my blog post about this: http://williamedwardscoder.tumblr.co...g-big-integers I'm curious as to if others have already noticed this, or exploited this?
2013-09-24, 09:42   #2
R.D. Silverman

Nov 2003

22·5·373 Posts

Quote:
 Originally Posted by William Edwards (I'm a rank hobbyist and I doubt my input is especially inspired, and I really just want to find out how useful the pattern I noticed is. Apologies aside:) I was looking at the part of the hyperbolic curve near the middle where the curve is very nearly diagonal, and noticed a simple, exploitable pattern: http://media.tumblr.com/2ecc00039204...acK1r3qp3f.png (You'll see that I chose to plot y going downwards, like a times-table.) Near the centre of the curve those squares go diagonally for some long run and then take one step downwards. This is because the curve is slightly greater than 45o, obviously. And if (x+1)*(y-1) < target, then x*y must also be less than target. You are only interested in finding and evaluating where it goes down one. So you can travel those diagonals using a binary search or by division. Here is my blog post about this: http://williamedwardscoder.tumblr.co...g-big-integers I'm curious as to if others have already noticed this, or exploited this?
Complete nonsense.

 2013-09-24, 11:45 #3 jasonp Tribal Bullet     Oct 2004 2·3·19·31 Posts Per your blog post, you can certainly prove a number to be prime, without factoring it, but the algorithms for doing that are pretty complex. The search term is 'primality proving'. It is much easier to think about factorization in algebraic terms, and much easier to find patterns using algebaic relationships than to try to spot colors in a table. For example, your experiments appear to be a graphical rediscovery of Fermat's factorization algorithm, which works especially well when factors are near the square root of the input. Fermat's algorithm is very easy to express algebraically (it's hundreds of years old). The objective with factorization is always to factor something bigger, and doing it by eye will not scale. At this point you if you want to really accelerate things you should go to wikipedia and read up on integer factorization; the articles on the various methods are quite good there and you'll be amazed how quickly they work. You also need to get into the habit of doing background reading before coding, especially if you are a professional programmer, because in 2013 it's very difficult to think of something new in the computer field and very easy to leverage the work of others. Last fiddled with by jasonp on 2013-09-24 at 11:46

 Similar Threads Thread Thread Starter Forum Replies Last Post Kosmaj Riesel Prime Search 1001 2021-01-26 12:01 petrw1 PrimeNet 1 2017-09-25 23:12 wustvn Puzzles 9 2007-12-31 05:14 jasong Programming 0 2007-10-03 20:34 mfgoode Puzzles 10 2004-12-27 15:17

All times are UTC. The time now is 13:14.

Tue Jan 26 13:14:08 UTC 2021 up 54 days, 9:25, 0 users, load averages: 3.77, 3.00, 2.85