I. Introduction On souhaite créer une fonction permettant de calculer le plus grand commun diviseur ou PGCD entre deux nombres entiers à l'aide de l'algorithme d'Euclide. Ensuite, toujours en se basant sur cet algorithme, on va créer une autre fonction qui pourra déterminer le PGCD de deux polynômes. II. Définitions mathématiques II-A. PGCD de nombres entiers D'après Wikipedia, en mathématiques, le ...
Code Python : Sélectionner tout - Visualiser dans une fenêtre à part 123456789101112131415#! python 3 # coding: utf-8 from termcolor import cprint from typing import List def diviseurs(a: int = 2, b: int = 2) -> List[int]: """Liste des diviseurs des nombres entiers a et b""" if a > 1 and b > 1: lst = [] for n in range(min(a, b), 0, -1): if (a % n == 0) and (b % n == 0): lst.append(n) return ...
#! python 3 # coding: utf-8 from termcolor import cprint from typing import List def diviseurs(a: int = 2, b: int = 2) -> List[int]: """Liste des diviseurs des nombres entiers a et b""" if a > 1 and b > 1: lst = [] for n in range(min(a, b), 0, -1): if (a % n == 0) and (b % n == 0): lst.append(n) return