title: How to optimize code for finding Amicable Pairs
body: <p>Please see the code I've used to find what I believe are all Amicable Pairs (n, m), n &lt; m, 2 &lt;= n &lt;= 65 million. My code: <a href="http://tutoree7.pastebin.com/wKvMAWpT" rel="nofollow">http://tutoree7.pastebin.com/wKvMAWpT</a>. The found pairs: <a href="http://tutoree7.pastebin.com/dpEc0RbZ" rel="nofollow">http://tutoree7.pastebin.com/dpEc0RbZ</a>.</p>
  
  <p>I'm finding that each additional million now takes 24 minutes on my laptop. I'm hoping there are substantial numbers of n that can be filtered out in advance. This comes close, but no cigar: odd n that don't end in '5'. There is only one counterexample pair so far, but that's one too many: (34765731, 36939357). That as a filter would filter out 40% of all n.   </p>
  
  <p>I'm hoping for some ideas, not necessarily the Python code for implementing them.</p>