1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
deux = set()
trois = set()
quatre = set()
cinq = set()
six = set()
sept = set()
SUPsept = set()
compt = 0
nombre = 0
while nombre < 1000:
nombre = nombre + 1
test = nombre
compt = 0
while test % 2 == 0:
test = test / 2
compt = compt + 1
if compt == 2:
deux.add(nombre)
if compt == 3:
trois.add(nombre)
if compt == 4:
quatre.add(nombre)
if compt == 5:
cinq.add(nombre)
if compt == 6:
six.add(nombre)
if compt == 7:
sept.add(nombre)
if compt > 7:
SUPsept.add(nombre)
pass
deux_sorted = sorted(deux)
trois_sorted = sorted(trois)
quatre_sorted = sorted(quatre)
cinq_sorted = sorted(cinq)
six_sorted = sorted(six)
sept_sorted = sorted(sept)
SUPSept_sorted = sorted(SUPsept)
print("\n\n")
print("------------- DIVISIBLE 2 FOIS-------------")
print(deux_sorted)
print("\n\n")
print("------------- DIVISIBLE 3 FOIS-------------")
print(trois_sorted)
print("\n\n")
print("------------- DIVISIBLE 4 FOIS-------------")
print(quatre_sorted)
print("\n\n")
print("------------- DIVISIBLE 5 FOIS-------------")
print(cinq_sorted)
print("\n\n")
print("------------- DIVISIBLE 6 FOIS-------------")
print(six_sorted)
print("\n\n")
print("------------- DIVISIBLE 7 FOIS-------------")
print(sept_sorted)
print("\n\n")
print("------------- DIVISIBLE > 7 FOIS-------------")
print(SUPSept_sorted)
print("\n\n") |
Partager