centos 安装命令 yum -y install pypy-libs pypy pypy-devel
装好了以后测试了一下,用下面这段代码
import time
def check(num):
a = list(str(num))
b = a[::-1]
if a == b:
return True
return False
def main():
all = xrange(1,10**7)
for i in all:
if check(i):
if check(i**2):
print i,i**2
if __name__ == '__main__':
begin = time.time()
main()
print time.time()-begin
1核1G的机器上试了下:
python 22.48 秒
pypy 3.7 秒