greatest-common-divisor Questions

2

Solved

def gcd(e, z): if z == 0: return e else: return gcd(z, e % z) e = int(input("Please enter the first number:")) z = int(input("Please enter the second number:")) print ("The GCD of ",e," and ...
Westernize asked 26/11, 2014 at 0:10

8

Suppose you have a list of floating point numbers that are approximately multiples of a common quantity, for example 2.468, 3.700, 6.1699 which are approximately all multiples of 1.234. How woul...

8

Solved

Here is the question: "Write a method named gcd that accepts two integers as parameters and returns the greatest common divisor of the two numbers. The greatest common divisor (GCD) of two i...
Fransis asked 2/12, 2012 at 20:37

2

Solved

The following relation works only for two (3, 12) numbers, it fails to produce the right answer when used for three numbers (3,12,10) . Just wondering if is it my understanding or it is just for tw...
Oversight asked 10/4, 2011 at 12:37

1

Solved

While doing my own BigInteger implementation, I got stuck with the extended GCD algorithm, which is fundamental for finding modular multiplicative inverse. As the well-known Euclidean approach perf...

3

Solved

I would like to find the greatest common divisor using JavaScript. Anyone done that before and willing to share?
Sardonic asked 3/7, 2013 at 10:11

0

So, Im using java to find the public key of a RSA password. Right now Im unsure what I'm doing and also if it's correct. I have this information for the public key. C = 5449089907 n = p*q = 827...
Gehlenite asked 10/4, 2013 at 1:24

2

Solved

I have started this program to calculate the greatest common divisor. This is what I have so far: #include <iostream> #include <math.h> using namespace std; int getGCD(int a, int...
Photoflash asked 25/9, 2011 at 23:11

1

Solved

I'm trying to use the y-combinator to define gcd in scala: object Main { def y[A,B]( f : (A => B) => A => B ) : A => B = f(y(f)) def gcd = y[(Int,Int),Int]( (g) => (x,y) => if ...
Gaullist asked 20/1, 2012 at 23:26

1

I'm a high school student writing a paper on RSA, and I'm doing an example with some very small prime numbers. I understand how the system works, but I can't for the life of me calculate the privat...
Javelin asked 12/12, 2010 at 16:26

2

Solved

One way is to calculate their gcd and check if it is 1. Is there some faster way?
Anthem asked 27/9, 2009 at 11:39

© 2022 - 2024 — McMap. All rights reserved.