/*************************************************************************************************************************************/
/* */
/* D E C O M P O S I T I O N E N F A C T E U R S P R E M I E R S D ' U N N O M B R E E N T I E R : */
/* */
/* */
/* Author of '$xtc/factorise.01$c' : */
/* */
/* Jean-Francois COLONNA (LACTAMME, AAAAMMJJhhmmss). */
/* */
/*************************************************************************************************************************************/
#include <stdio.h>
/* Introduit le 20090430181958... */
extern double sqrt();
void factorisation(entier)
int entier;
{
int racine_carree=(int)sqrt((double)entier);
int entier_courant=entier;
int diviseur_courant=2;
int nombre_de_facteurs=0;
printf("\n %d = 1",entier);
while (diviseur_courant <= racine_carree)
{
if ((entier_courant%diviseur_courant) == 0)
{
printf("x%d",diviseur_courant);
entier_courant = entier_courant/diviseur_courant;
nombre_de_facteurs++;
}
else
{
diviseur_courant++;
}
}
if (nombre_de_facteurs == 0)
{
printf("x%d",entier);
}
else
{
}
}
main()
{
factorisation(262144);
factorisation(448500);
factorisation(37);
printf("\n");
}
Copyright © Jean-François COLONNA, 2021-2024.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / École polytechnique, Institut Polytechnique de Paris, 2021-2024.