Mathématiques

Question

Je ne comprend pas l'exercice sur les divisibilité.
Je ne comprend pas l'exercice sur les divisibilité.

1 Réponse

  • Attention , Ma démonstration n'est  pas complète.. (36 est aussi ouvert même si 6 n'est pas un nombre premier)
    Mais cela requiert surement un niveau supérieur au collège.
    Tout tiroir ayant pour numéro un carré <101 est ouvert.

    En bonus:
    CONST Faux = 0 = 1
    CONST Vrai = NOT (Faux)
    CONST nb = 100
    DIM SHARED ar(nb) AS INTEGER
    DIM i AS INTEGER, j AS INTEGER
    '1
    CALL Init
    FOR i = 1 TO nb: ar(i) = Vrai: NEXT i
    FOR i = 2 TO nb
        '    FOR j = 1 TO INT(nb / i)
        FOR j = i TO nb STEP i
            ar(j) = NOT (ar(j))
            ' ar(i * j) = NOT (ar(i * j))
        NEXT j
    NEXT i
    CALL See
    END

    SUB See
    SHARED ar() AS INTEGER
    DIM i AS INTEGER, k AS INTEGER
    k = 0
    FOR i = 1 TO nb
        IF ar(i) THEN
            PRINT USING "### "; i;
            k = k + 1
            IF k = 25 THEN PRINT: k = 0
        END IF
    NEXT i
    END SUB

    SUB Init
    SCREEN 0: WIDTH 150, 45: _FONT 16
    _SCREENMOVE _MIDDLE
    _MOUSESHOW
    CLS
    END SUB