Last active
August 29, 2015 14:15
-
-
Save kishaningithub/fc03058dcc88359006ca to your computer and use it in GitHub Desktop.
Competitive programming maths
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Is Fibonacci | |
- Either 5x^2+4 or 5x^2-4 must be a perfect square | |
No of perfect squares between a and b | |
- floor(sqrt(b)) - ceil(sqrt(a)) + 1 | |
GCD (Euclid's algorithm) - | |
p>0 q>0. If q is 0 p is gcd. If not divide p by q | |
and take the remainder r. The gcd is the gcd(q,r). | |
gcd(p,q) | |
if(q=0) | |
return p | |
r = p % q | |
return gcd(q,r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment