Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.042 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'python': 0.08; 'from:addr:python': 0.09; 'problem:': 0.09; 'wrote:': 0.14; 'factors.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'reply-to:addr:python-list': 0.16; 'subject: \n ': 0.16; 'subject:was': 0.16; 'header:In-Reply-To:1': 0.21; 'right,': 0.22; 'smallest': 0.23; 'received:84': 0.25; 'function': 0.25; "i'm": 0.27; 'subject:How': 0.30; 'to:addr :python-list': 0.33; 'header:User-Agent:1': 0.35; 'reply- to:addr:python.org': 0.35; 'stuck': 0.35; 'positive': 0.38; 'subject:can': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'subject: (': 0.39; 'to:addr:python.org': 0.39; 'getting': 0.40; 'subject:, ': 0.60; 'john': 0.62; 'taking': 0.64; 'subject:. ': 0.65; '"what': 0.67; 'header:Reply-To:1': 0.72; 'reply-to:no real name:2**0': 0.72; 'prime': 0.73; 'forever': 0.84; 'subject:over': 0.84; 'subject:much': 0.93 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjIIAPVNAU7Unw4S/2dsb2JhbABUmDWOVneIdb8FhisElkuLKA Date: Wed, 22 Jun 2011 03:10:02 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: python-list@python.org Subject: Re: sorry, possibly too much info. was: Re: How can I speed up a script that iterates over a large range (600 billion)? References: <4e00faa9$0$49180$e4fe514c@news.xs4all.nl> <4e00fd85$0$49038$e4fe514c@news.xs4all.nl> <8b8c4bc8-7b26-4113-b95b-7eccbbd0e901@q30g2000yqb.googlegroups.com> <7x39j2ivcr.fsf@ruckus.brouhaha.com> <4c37d4e6-1c34-453c-8417-6b2c22e98451@l18g2000yql.googlegroups.com> In-Reply-To: <4c37d4e6-1c34-453c-8417-6b2c22e98451@l18g2000yql.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308708606 news.xs4all.nl 49179 [::ffff:82.94.164.166]:41289 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8165 On 22/06/2011 02:21, John Salerno wrote: > ::sigh:: Well, I'm stuck again and it has to do with my get_factors > function again, I think. Even with the slight optimization, it's > taking forever on 20! (factorial, not excitement) :) It's frustrating > because I have the Python right, but I'm getting stuck on the math. > > The problem: > > "What is the smallest positive number that is evenly divisible by all > of the numbers from 1 to 20?" > You don't need factorials, just remember that each of the numbers can be expressed as the product of a multiset of prime factors.