On Wed, Jun 22, 2011 at 7:48 AM, John Salerno <johnj...@gmail.com> wrote:
> Thanks for the all the advice everyone. Now I'm on to problem #4, and
> I'm stumped again, but that's what's fun! :)

So now that you've solved it, I'd like to see some fast one-liners to
do the job. (Since Python cares about whitespace, it might not
_technically_ fit on one line, but in the spirit of one-liners, try to
keep it short.)

Here's what I did in Pike, very quickly:
exec 600851475143; for (int i=2;i<ret;++i) while (ret%i==0) ret/=i

Porting it to Python:
ret,i=600851475143,2
while i<ret:
  while not ret%i:
    ret//=i

Bring on your simpler solutions!

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to