PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > linux.debian.user > how to find GCD and LCM in C ?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
linux.debian.user debian-user@lists.debian.org.

how to find GCD and LCM in C ?

Réponse
 
LinkBack Outils de la discussion
Vieux 03/12/2006, 19h40   #1 (permalink)
Jabka Atu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut how to find GCD and LCM in C ?

Hello.
im studieng math now and many time i need to find GCD (Great Common
Divider) and LCM (Least Common Member).
I can create a loop to find it by dividing by list of prime numbers then
finding thier ^ (i dont how it is call in english but for example 2^2 =4 )


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Vieux 04/12/2006, 02h50   #2 (permalink)
Rogério Brito
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Off-Topic: Re: how to find GCD and LCM in C ?

Hi, Jabka.

On Dec 02 2006, Jabka Atu wrote:
> im studieng math now and many time i need to find GCD (Great Common
> Divider) and LCM (Least Common Member).


I supose that you're talking about integers here, since you didn't say
anything about polynomials, Euclidean Domains and such (and, come to
think of it, if you actually knew about them, you'd know how to compute
that in no amount of time).

Anyway, since this sounds like homework, I will only give you guidelines
for your task:

* first of all, you can find the gdc of two integers a, b (not both
zero) quite efficiently with Euclid's Algorithm (search the web for
this). Even more instructive is the use of Euclid's Extented
Algorithm, which calculates the gdc(a,b) as an (integer) linear
combination of both a and b;

* second, given the fact that the bot a and b are divisible by gcd(a, b)
*AND* ab = gcd(a,b) lcm(a,b), you can find the lcm(a,b) quite easily.


Hope this s, Rogério Brito.

--
Rogério Brito : rbrito@ime.usp.br : http://www.ime.usp.br/~rbrito
Homepage of the algorithms package : http://algorithms.berlios.de
Homepage on freshmeat: http://freshmeat.net/projects/algorithms/


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h52.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07989 seconds with 10 queries