51 routines :

*AppleScriptsVanilla*
ascii_to_HTML
Average
Calculator
Calendar
Count_item
cut_text
days_week
EAN13
Encrypt-Decrypt
FactPremier
French_Vanilla_Dotted_Date
French_Vanilla_Dotted_Date2
Hexa_to_Bin
Last_month
list_erase
list_insert
list_replace
ListeDiviseurs
ListePremiers
Minuscule
NombreLong
NombreLong2
NomExtension
num_item
num_month
num_month2
num_week
number_format
number_format2
Paques
PGCD
PGCD2
reverse_string
Roman_to_Arab
round_decimal
search_email
search_replace
search_URL
SepNbre
SepNbre2
snip_text
stat
TauxPermut
TauxTransform
the_left
the_right
TriBulle
TriLineaire
week_and_year
XOR
ZeroDouble

PGCD2

Syntaxe

PGCD2(n1, n2)
Calcule le PGCD de 2 nombres n1 et n2. Les paramètres et le résultat sont au format nombre.
Par mickay.jill@9online.fr

Exemple

PGCD2(35, 15)
---> 5

Script

on PGCD2(n1, n2)
repeat
if n1 > n2 then
set a to n1 - n2
set n2 to n1
set n1 to a
else if n1 < n2 then
set a to n1
set n1 to n2 - n1
set n2 to a
end if
if n1 = n2 then exit repeat
end repeat
return n1
end PGCD2

Remarque

Méthode par soustractions successives.

Site scripté avec HyperCard ©1987-1998 Apple Computer, Inc.
Mise à jour le 19/01/10 à 08:45:57