• Aucun résultat trouvé

test_probabiliste(N, 1000)) print('nb_test = 5000

N/A
N/A
Protected

Academic year: 2022

Partager "test_probabiliste(N, 1000)) print('nb_test = 5000"

Copied!
1
0
0

Texte intégral

(1)

from math import pi

from random import randint # bornes comprises N = 1000

def pgcd(a, b):

while b != 0:

a, b = b, a%b return a

def test(N):

compteur = 0

for i in range(1, N+1):

for j in range(1, N+1):

if pgcd(i, j) == 1:

compteur += 1 return compteur / N**2

def test_probabiliste(N, nb_test):

compteur = 0

for i in range(nb_test):

p, q = randint(1, N), randint(1, N) if pgcd(p, q) == 1:

compteur += 1

return compteur / nb_test

print('test : ', test(N))

print('nb_test = 1000, ', test_probabiliste(N, 1000))

print('nb_test = 5000, ', test_probabiliste(N, 5000))

print('6 / pi**2 : ', 6 / pi**2 )

1

Références

Documents relatifs

If the initiator specifies a page descriptor that is not supported by the CRD-5000, the command will tenninate with a CHECK CONDITION status (IL- LEGAL REQUEST

the system, such as printer and file server names and addresses, the setup types currently available to the printers, and the numbers of those slots containing

The code (44) is provided for software compatibility with an earlier controller model.. Sense data will be cleared upon reception of any subsequent command

La potence ci-dessous permet de soulever des charges de 500Kg maximum quand le palan 4 se trouve à l’extrémité de la flèche 11. Cette flèche ainsi que l’équerre 3 forment un

Considerations affecting the planning of a system cabling installation include cable length, cable routing, ambient noise environment, cable types, existing onsite

This Unisys product contains a battery which automatically provides emergency current for retention of memory data in the event of a short AC power

b. Fi rmware Self-test. M:>dem Diagnostic Hood Test. If the above procedures are carried out successfully, it is reasonably certain that the interface cards and

La première sera consacrée à définir la thèse centrale du livre ; la deuxième abordera les deux grandes conceptions de la monnaie que Graeber attribue aux