Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror

Comment Re:Yay! (Score 1) 413

this is my favorite link to show to the Pythoon nutjobs that praise it for its RAD-iness and ease of use.

Came in late, but I hope you're just trolling and don't really believe this.

I translated the PHP "solutio" right above it to Python in just a few minutes (not having even used Python in the past 2 years!). To top it off, the PHP version DOESN'T EVEN WORK CORRECTLY. It's missing floating point/integer conversions and gives wrong digits after 314159... The python version, translated exactly, works just fine. I'm sure if I remembered more python tricks this could be condensed considerably:


import sys
scale = 10000; maxarr = 2800; arrinit = 2000; carry = 0; arr = []
for i in range(maxarr+1): arr.append( arrinit )
for i in range(maxarr, 1, -14):
                sum = 0
                for j in range(i, 0, -1):
                                sum = (sum * j) + (scale * arr[j])
                                arr[j] = sum % ( (j*2)-1 )
                                sum = sum / ((j*2)-1)
                sys.stdout.write("%04d" % (carry + (sum / scale)))
                carry = sum % scale

Slashdot Top Deals

FORTUNE'S FUN FACTS TO KNOW AND TELL: A firefly is not a fly, but a beetle.

Working...