I was wondering if its possible in constant time to calculate the above mentioned goal. I need it to solve a problem on codechef.
How we can find GCD(k + a, k + b) if we already know the GCD(a, b)?
362 Views Asked by Harshit Dubey At
1
There are 1 best solutions below
Related Questions in MATH
- bc: prevent "divide by zero" runtime error on multiple operations
- How to round smoothly percentage in JS
- Calculate if trend is up, down or stable
- How to pick a number based on probability?
- Python 2.7 - find combinations of numbers in a list that add to another number
- How to translate an object to a location slowly (so that it can be seen)
- max() implemented with basic operators
- Matlab: how to fit time series with a funcion of a certain type
- 3D B-Spline approximation
- Issues with adding doubles. Arithmetic Coding
- Calculate new position post rotation
- Javascript: PI (π) Calculator
- How to compute a^^b mod m?
- Need Custom Query in SQL Server
- Number of divisiors upto 10^6
Related Questions in MATHEMATICAL-OPTIMIZATION
- Issue with constrOptim
- out of memory in matlab run time
- How to convert quadratic to linear program?
- How to create upper bound on many variables w/ lpsolve in R?
- Finding a vector that is approximately equally distant from all vectors in a set
- Constrained quadratic optimization with the quadProg library
- R: Isotonic regression Minimisation
- How can I minimize this function in R?
- R: Quadratic programming/ Isotonic regression
- GRG Non linear constraint solver for iOS suggestions
- Two way constraint distribution optimization in R
- How do I speed up profiled NumPy code - vectorizing, Numba?
- How to do a math optimization (TSP) in R, perhaps with optim()
- Where is the 0=1 bug coming from in this Mathematica code?
- Trading run-time for higher fit accuracy?
Related Questions in EUCLIDEAN-ALGORITHM
- Can anyone explain how this code works? GCD, Recursive, Euclidian algorithm
- Prove of Euclid's algorithm of successive subtraction for the greatest common divisor
- Is it possible to implement the extended euclidean algorithm with unsigned machine words?
- How we can find GCD(k + a, k + b) if we already know the GCD(a, b)?
- Time Complexity of Euclid Algorithm by Subtraction
- Implement modInverse using Extended Euclid Algorithm in Java
- Divide by zero, can't find the problem in this program which runs Euclid's algorithm to find the greatest common divisor
- Calculating euclidean distance in a matrix
- Unnormalizing in Knuth's Algorithm D
- I want to get two numbers as input and calculate all the possible differences in Python
- Is there any way to perform this type of recursion in C++ or python?
- Euclidean algorithm explanation?
- Understanding implementation of Extended Euclidean algorithm
- Evaluating implementation of Extended Euclidean algorithm
- Python - Print steps of an extended euclidean algorithm
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
It is impossible to compute
gcd(a+k,b+k)in constant time knowing onlygcd(a,b).Suppose that
c,dare any two natural numbers withd < c.Let
Then we know in
O(1)time thatIf we could compute
gcd(a+k,b+k) = gcd(c,d)inO(1)additional time, then we could compute all gcds inO(1)time, which is impossible.Having said all that, it is of course possible that in some cases of interest, knowledge of
gcd(a,b)could lead to faster computation ofgcd(a+k,b+k)than would otherwise be possible.