Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

Can anyone fix my code so it works? Python 2 http://ideone.com/xLsnH

OpenStudy (anonymous):

works fine for smaller numbers

OpenStudy (anonymous):

http://ideone.com/sfSCA

OpenStudy (anonymous):

That's the problem with recursive functions. O(n) algorithms also use O(n) stack frames, so they'll only work for small numbers. http://ideone.com/OrOSi I guess python has a 1000-frame limit. But how cool is it that it calculated 999! in 20ms?

OpenStudy (anonymous):

10 mS non-recursive http://ideone.com/7BccE

OpenStudy (anonymous):

I was able to get up to 21000! with bwCA's iterative version before ideone timed out. Over 81k digits!

OpenStudy (anonymous):

http://ideone.com/0RVI9 It also breaks when you put in stuff above 21000

OpenStudy (anonymous):

I think that's a limitation of ideone. SIGXFSZ means the process exceeded some maximum file size. I don't know exactly what that means, but it does return a number, but the number is missing a great many 0's at the end, so it must have been truncated. Maybe ideone also has a limit on the amount of output it will return to the http client.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!