#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 20 08:10:00 2025

@author: pjoulaud
"""
import doctest


def pgcd(a:int,b:int)->int:
    """
    Calcule le plus grand commun diviseur

    Parameters
    ----------
    a : int
        numérateur
    b : int
        dénominateur

    Returns
    -------
    int
        PGCD.
    >>> pgcd(9, 6)
    3
    >>> pgcd(35, 25)
    5
    >>> pgcd(45, 30)
    15

    """
    if b==0: # cas de base
        return a
    else : 
        return pgcd(b, a%b)

def simplification_fraction(a, b):
    p = pgcd(a, b)
    c = a // p
    d = b // p
    return c, d

def compte_a_rebour(n:int)->list:
    if n==0 :  # Cas de base
        return [0]
    return [n] + compte_a_rebour(n-1)


    
doctest.testmod()    



