Unusual Speed Difference between Python and C++

后端 未结 17 2301
庸人自扰
庸人自扰 2020-12-22 21:25

I recently wrote a short algorithm to calculate happy numbers in python. The program allows you to pick an upper bound and it will determine all the happy numbers below it.

17条回答
  •  情深已故
    2020-12-22 21:47

    Here's some food for thought: If given the choice of running a 1979 algorithm for finding prime numbers in a 2009 computer or a 2009 algorithm on a 1979 computer, which would you choose?

    The new algorithm on ancient hardware would be the better choice by a huge margin. Have a look at your "helper" functions.

提交回复
热议问题