Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-05 Thread Terry Carroll
On Fri, 5 Sep 2008, Terry Carroll wrote: > On Sat, 6 Sep 2008, John Fouhy wrote: > > > You can count the number of fives in the prime decomposition of a > > number by just dividing by 5 repeatedly until you don't get a whole > > number. > > But that requires having the number first, doesn't it?

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-05 Thread Terry Carroll
On Sat, 6 Sep 2008, John Fouhy wrote: > 2008/9/5 Terry Carroll <[EMAIL PROTECTED]>: > > So here's my routine to address the problem. It consists of making a > > multiplication table of coefficients that includes the factor such as 5, > > 25, 125, etc., and their values (1, 6, 31, etc). Then, sta

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-05 Thread John Fouhy
2008/9/5 Terry Carroll <[EMAIL PROTECTED]>: > So here's my routine to address the problem. It consists of making a > multiplication table of coefficients that includes the factor such as 5, > 25, 125, etc., and their values (1, 6, 31, etc). Then, starting with the > highest ones first, successiev

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-05 Thread Robert Berman
Wow. What a group. Terry, don't feel bad about the answer. I already derived it using all the information I got yesterday. Your solution is a very nice addition to what I learned, and I appreciate that very much. Again, thanks to everyone who provided hints, equations, proofs, and logic paths

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-04 Thread Terry Carroll
On Thu, 4 Sep 2008, Robert Berman wrote: > Time to do some reading about regex. And here I thought I was slick > working with lists and strings. You shouldn't need a regexp for this. An easy way to count the trailing zeros is: - convert the number to a string; - make a copy, stripping off the

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-04 Thread Terry Carroll
On Thu, 4 Sep 2008, Robert Berman wrote: > "It can easily be seen that 6! = 720 and has exactly one > trailing zero. What is the lowest integer, x, such that x! has 7^20 > trailing zeros?" > > It does not, on the surface, appear to be a frontal lobe breaker. Design > an algorithm to build factori

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-04 Thread Robert Berman
Chris, Thank you very much for this. It is very helpful. I will check my answer against yours in the morning. Robert Chris Fuller wrote: I spent the day mulling over this problem, and then implemented my solution when I got home. This is for the easier problem of 7**8 zeros: On my linux

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-04 Thread Chris Fuller
I spent the day mulling over this problem, and then implemented my solution when I got home. This is for the easier problem of 7**8 zeros: On my linux box, running something around 2 GHz, my script runs for about two minutes and the answer is 23059225. You can verify your code to that. I ch

Re: [Tutor] Need help with Factorial algorithm using Python

2008-09-04 Thread Robert Berman
Thank you  very much for the help and the math explanation from Omer.  Much of my math background is based on  brute force methodology. Obviously, things have changed. Really changed. Time to do some reading about regex. And here I thought I was slick working with lists and strings. Robert

[Tutor] Need help with Factorial algorithm using Python

2008-09-04 Thread Robert Berman
I am using both the THINK PYTHON text and the Challenge-You website to learn Python. I am doing reasonably well and certainly enjoy the available challenges. I am currently attempting to work a challenge known as the 'Zeros of a Factorial' challenge located at http://www.challenge-you.com/ch