3 ms·
The python equivalent: real 0m21.891s On machine in which the C Variant: real 0m0.570s But - I learned about Cython today, so great article. Interestin
by ghshephard 13y ago
The python equivalent:
real 0m21.891s
On machine in which the C Variant:
real 0m0.570s
But - I learned about Cython today, so great article.
Interesting that the Python Version takes so much longer.
import sys
check=int(sys.argv[1])
lnum=1
lcount=1
for x in range(1,check):
len=1
a=x
while (a>1):
len+=1
if a%2==0:
a=a/2
else:
a=(a*3+1)/2
if len > lcount:
lcount=len
lnum=x
print lcount,lnum