/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        E T U D E   D E   L A   S U I T E   D E   S Y R A C U S E  :                                                               */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '$xrk/Syracuse.11.2$I' :                                                                                         */
/*                                                                                                                                   */
/*                    Jean-Francois COLONNA (LACTAMME, 20130115141203).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        M A C R O S   U T I L E S  :                                                                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#define   INCREMENTER_LE_NIVEAU_DE_MARQUAGE(niveau_de_marquage_courant)                                                                 \
                    Bblock                                                                                                              \
                    INCR(niveau_de_marquage_courant,PAS_COULEURS);                                                                      \
                                        /* Ainsi, le niveau de marquage evolue pour chaque nouveau couple de nombres premiers...     */ \
                                                                                                                                        \
                    Test(IFEXff(niveau_de_marquage_courant,NOIR_PLANCHER,BLANC))                                                        \
                         Bblock                                                                                                         \
                         EGAL(niveau_de_marquage_courant,NOIR_PLANCHER);                                                                \
                         Eblock                                                                                                         \
                    ATes                                                                                                                \
                         Bblock                                                                                                         \
                         Eblock                                                                                                         \
                    ETes                                                                                                                \
                    Eblock                                                                                                              \
                                        /* Procedure introduite le 20130115101940...                                                 */

#define   CALCUL_D_UNE_SUITE_DE_SYRACUSE(U0)                                                                                            \
                    Bblock                                                                                                              \
                    DEFV(Int,INIT(U_n,AXPB(homothetie__U0,U0,translation_U0)));                                                         \
                                        /* Definition de U(n) (La transformation de 'U(0)' a ete introduite le 20130115180211).      */ \
                                                                                                                                        \
                    DEFV(Logical,INIT(iterer,VRAI));                                                                                    \
                    DEFV(Int,INIT(nombre_d_iterations,ZERO));                                                                           \
                                        /* Controle des iterations sachant que l'on s'arrete sur le premier 4 rencontre ou bien si   */ \
                                        /* le nombre d'iterations maximal est atteint...                                             */ \
                    DEFV(Int,INIT(rang_d_apparition_de_la_valeur_d_arret                                                                \
                                 ,rang_initial_d_apparition_de_la_valeur_d_arret                                                        \
                                  )                                                                                                     \
                         );                                                                                                             \
                    DEFV(Logical,INIT(on_a_rencontre_la_valeur_d_arret,FAUX));                                                          \
                                        /* Afin de savoir a partir de quand apparait {4,2,1} ?                                       */ \
                    DEFV(genere_p,INIT(niveau_de_marquage_courant_fonction_du_rang,NOIR_PLANCHER));                                     \
                                        /* Niveau de marquage courant a l'aide du rang 'n'...                                        */ \
                                                                                                                                        \
                    Test(IL_FAUT(editer_les_suites))                                                                                    \
                         Bblock                                                                                                         \
                         CALS(FPrme0("="));                                                                                             \
                         Eblock                                                                                                         \
                    ATes                                                                                                                \
                         Bblock                                                                                                         \
                         Eblock                                                                                                         \
                    ETes                                                                                                                \
                                                                                                                                        \
                    Tant(IL_FAUT(iterer))                                                                                               \
                         Bblock                                                                                                         \
                         Test(EST_FAUX(on_a_rencontre_la_valeur_d_arret))                                                               \
                              Bblock                                                                                                    \
                              Test(IL_FAUT(editer_les_suites))                                                                          \
                                   Bblock                                                                                               \
                                   Test(IL_FAUT(visualiser_la_parite_des_elements_de_la_suite))                                         \
                                        Bblock                                                                                          \
                                        CAL3(Prme1(" %d",PARI(U_n)));                                                                   \
                                        Eblock                                                                                          \
                                   ATes                                                                                                 \
                                        Bblock                                                                                          \
                                        CAL3(Prme1(" %d",U_n));                                                                         \
                                        Eblock                                                                                          \
                                   ETes                                                                                                 \
                                   Eblock                                                                                               \
                              ATes                                                                                                      \
                                   Bblock                                                                                               \
                                   Eblock                                                                                               \
                              ETes                                                                                                      \
                                                                                                                                        \
                              store_point_valide(COND(IL_FAUT(visualiser_la_parite_des_elements_de_la_suite)                            \
                                                     ,COND(EST_PAIR(U_n)                                                                \
                                                          ,niveau_de_la_parite___paire                                                  \
                                                          ,COND(EST_IMPAIR(U_n)                                                         \
                                                               ,niveau_de_la_parite_impaire                                             \
                                                               ,NIVEAU_UNDEF                                                            \
                                                                )                                                                       \
                                                           )                                                                            \
                                        /* Il n'est en fait pas tres utile de tester 'EST_IMPAIR(...)' mais je le fait malgre tout,  */ \
                                        /* par "symetrie"...                                                                         */ \
                                                     ,COND(IL_FAUT(visualiser_a_l_aide_du_rang_dans_la_suite)                           \
                                                          ,niveau_de_marquage_courant_fonction_du_rang                                  \
                                                          ,niveau_de_marquage_courant_fonction_de_U0                                    \
                                                           )                                                                            \
                                                      )                                                                                 \
                                                ,ImageR                                                                                 \
                                                ,X,COYA(SOUS(U_n,premier_nombre_entier))                                                \
                                                ,FVARIABLE                                                                              \
                                                 );                                                                                     \
                                        /* La visualisation de la parite a ete introduite le 20190418105441...                       */ \
                                                                                                                                        \
                              Test(IFEQ(U_n,valeur_d_arret))                                                                            \
                                   Bblock                                                                                               \
                                   EGAL(on_a_rencontre_la_valeur_d_arret,VRAI);                                                         \
                                   EGAL(iterer,FAUX);                                                                                   \
                                        /* C'est termine...                                                                          */ \
                                   Eblock                                                                                               \
                              ATes                                                                                                      \
                                   Bblock                                                                                               \
                                   INCR(rang_d_apparition_de_la_valeur_d_arret,I);                                                      \
                                   Eblock                                                                                               \
                              ETes                                                                                                      \
                              Eblock                                                                                                    \
                         ATes                                                                                                           \
                              Bblock                                                                                                    \
                              Eblock                                                                                                    \
                         ETes                                                                                                           \
                                                                                                                                        \
                         EGAL(U_n                                                                                                       \
                             ,COND(EST_PAIR(U_n)                                                                                        \
                                  ,DIVI(U_n,diviseur)                                                                                   \
                                  ,AXPB(alpha___,U_n,beta____)                                                                          \
                                   )                                                                                                    \
                              );                                                                                                        \
                                        /* Calcul de la suite de Syracuse "generalisee" :                                            */ \
                                        /*                                                                                           */ \
                                        /*                  U  = U    / D       si U    est pair,                                    */ \
                                        /*                   n    n-1               n-1                                              */ \
                                        /*                                                                                           */ \
                                        /*                  U  = A * U    + B   si U    est impair,                                  */ \
                                        /*                   n        n-1           n-1                                              */ \
                                        /*                                                                                           */ \
                                        /* avec :                                                                                    */ \
                                        /*                                                                                           */ \
                                        /*                  D = diviseur = 2                                                         */ \
                                        /*                  A = alpha    = 3                                                         */ \
                                        /*                  B = beta     = 1                                                         */ \
                                        /*                                                                                           */ \
                                        /* et :                                                                                      */ \
                                        /*                                                                                           */ \
                                        /*                  U  = 1                                                                   */ \
                                        /*                   0                                                                       */ \
                                        /*                                                                                           */ \
                                        /* par defaut.                                                                               */ \
                                        /*                                                                                           */ \
                                        /* La conjecture enonce que quel que soit 'U(0)' de depart, a un moment apparait de facon    */ \
                                        /* periodique (et alors jusqu'a la fin des temps...) la suite {4,2,1}...                     */ \
                                                                                                                                        \
                         INCR(nombre_d_iterations,I);                                                                                   \
                                                                                                                                        \
                         Test(IFGE(nombre_d_iterations,nombre_maximal_d_iterations))                                                    \
                              Bblock                                                                                                    \
                              EGAL(iterer,FAUX);                                                                                        \
                                        /* On a fait trop d'iterations : on arrete...                                                */ \
                              Eblock                                                                                                    \
                         ATes                                                                                                           \
                              Bblock                                                                                                    \
                              Eblock                                                                                                    \
                         ETes                                                                                                           \
                                                                                                                                        \
                         INCREMENTER_LE_NIVEAU_DE_MARQUAGE(niveau_de_marquage_courant_fonction_du_rang);                                \
                                        /* Ainsi, le niveau de marquage evolue pour chaque nouveau couple de nombres premiers...     */ \
                         Eblock                                                                                                         \
                    ETan                                                                                                                \
                                                                                                                                        \
                    INCREMENTER_LE_NIVEAU_DE_MARQUAGE(niveau_de_marquage_courant_fonction_de_U0);                                       \
                                        /* Ainsi, le niveau de marquage evolue pour chaque nouvelle suite...                         */ \
                                                                                                                                        \
                    Test(IL_FAUT(editer_les_suites))                                                                                    \
                         Bblock                                                                                                         \
                         CALS(Fsauts_de_lignes(UN));                                                                                    \
                         Eblock                                                                                                         \
                    ATes                                                                                                                \
                         Bblock                                                                                                         \
                         Eblock                                                                                                         \
                    ETes                                                                                                                \
                    Eblock                                                                                                              \
                                        /* Procedure calculant 'U(n)' a partir de 'U(0)'...                                          */



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