/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        C R E A T I O N   D E   S U I T E S   D ' E N T I E R S   " A   L A   G O D E L "  :                                       */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '$xtc/SuitesGodel.01$vv$c' :                                                                                     */
/*                                                                                                                                   */
/*                    Jean-Francois Colonna (LACTAMME, 20220319094127).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

#include  "INCLUDES.01.I"
extern    double    pow();

int       NombresPremiers[]={2,3,5,7,11,13,17,19,23,29,31,37,41,-1};
                                        /* La fin de la liste des nombres premiers est materialisee par une valeur negative...       */

#define   GENERE(decimales,nom)                                                                                                         \
                    {                                                                                                                   \
                    printf("Suite basee sur '%s' :\n\n",nom);                                                                           \
                    Godel(decimales);                                                                                                   \
                    printf("\n\n");                                                                                                     \
                    }

int       EditerFactorisation=VRAI;
                                        /* Indicateur introduit le 20220320105616 pour controler l'edition...                        */

void      Godel(ListeNombres)
int       ListeNombres[];
          {
          int       iterer=VRAI;
          int       index1=0;
          int       index2=0;

          while     (iterer == VRAI)
                    {
                    if        ((NombresPremiers[index1] > 0) && (ListeNombres[index1] >= 0))
                              {
                              long int  produit=1;

                              for       (index2=0 ; index2 <= index1 ; index2++)
                                        {
                                        long int  exponentielle=(long int)pow((double)NombresPremiers[index2],(double)ListeNombres[index2]);
                                        produit = produit*exponentielle;

                                        if        (EditerFactorisation == VRAI)
                                                  {
                                                  printf("(%d^%d)",NombresPremiers[index2],ListeNombres[index2]);

                                                  if        (index2 < index1)
                                                            {
                                                            printf("x");
                                                            }
                                                  else
                                                            {
                                                            printf(" = %ld\n",produit);
                                                            }
                                                  }
                                        else
                                                  {
                                                  if        (index2 == index1)
                                                            {
                                                            printf("%ld\n",produit);
                                                            }
                                                  else
                                                            {
                                                            }
                                                  }
                                        }
                              }
                    else
                              {
                              if        (NombresPremiers[index1] <= 0)
                                        {
                                        printf("ATTENTION : debordement la liste des nombres premiers.\n");
                                        }
                              else
                                        {
                                        }

                              iterer = FAUX;
                              }

                    index1++;
                    }
          return;
          }

void      main()
          {
          int       pi___[]={1,4,1,5,9,-1};
          int       e____[]={7,1,8,2,8,-1};
          int       phi__[]={6,1,8,0,3,-1};
                                        /* La fin de la liste des decimales est materialisee par une valeur negative (impossible     */
                                        /* en tant que decimale...).                                                                 */
                                        /*                                                                                           */
                                        /* ATTENTION : il est impossible d'aller au-dela a cause des problemes de debordement de     */
                                        /* capacite.                                                                                 */
                                        /*                                                                                           */
                                        /* La seule solution est alors avec '$BC' ('v $xtb/SuitesGodel.01.SubmissionSloane.pi').     */

          GENERE(pi___,"pi");
          GENERE(e____,"e");
          GENERE(phi__,"phi");
          }



Copyright © Jean-François Colonna, 2022-2023.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / École polytechnique, Institut Polytechnique de Paris, 2022-2023.