Giter Club home page Giter Club logo

Comments (4)

ctx2002 avatar ctx2002 commented on August 21, 2024

"两个整数的最大公约数等于其中较小的数和两数的差的最大公约数",
"两数的差" 因该是 “两数相除的余数”吧?
gcd(a,b)=gcd(b,a mod b)

难道
gcd(a,b)=gcd(a-b,b)也是对的?

from algo.

ctx2002 avatar ctx2002 commented on August 21, 2024

刚才算了以下,还真是的。为什么网上的算法,都是用 mod 而不用 ‘差’了?
难道用‘差’有什么问题?

希望把这个用‘差’的算法也写以下。

from algo.

ctx2002 avatar ctx2002 commented on August 21, 2024

今天想了一下, 为什么网上的程序用‘mod’,而不用‘差’?。
这可能是因为,用‘差’的程序要用到‘if’,而用‘mod’的程序不用’if‘。
'if'可能会对CPU的执行有影响

from algo.

songlin-zheng avatar songlin-zheng commented on August 21, 2024

@ctx2002
今天想了一下, 为什么网上的程序用‘mod’,而不用‘差’?。
这可能是因为,用‘差’的程序要用到‘if’,而用‘mod’的程序不用’if‘。
'if'可能会对CPU的执行有影响

分支预测肯定会有影响吧

from algo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.