Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *The Code*
- def units(n):
- u = []
- elem = list(range(1,n))
- o = 1
- while o < n:
- for x in elem:
- if (x * o) % n == 1:
- if o not in u:
- list.append(u,o)
- o += 1
- print("The Units for the Integers Mod ", str(n), " are: ", str(u))
- b = "{:.0%}".format(len(u)/n)
- print("The percentage of which is ", str(b))
- a = list(range(2,51))
- for x in a:
- units(x)
- *********************************************************
- *The Results*
- The Units for the Integers Mod 2 are: [1]
- The percentage of which is 50%
- The Units for the Integers Mod 3 are: [1, 2]
- The percentage of which is 67%
- The Units for the Integers Mod 4 are: [1, 3]
- The percentage of which is 50%
- The Units for the Integers Mod 5 are: [1, 2, 3, 4]
- The percentage of which is 80%
- The Units for the Integers Mod 6 are: [1, 5]
- The percentage of which is 33%
- The Units for the Integers Mod 7 are: [1, 2, 3, 4, 5, 6]
- The percentage of which is 86%
- The Units for the Integers Mod 8 are: [1, 3, 5, 7]
- The percentage of which is 50%
- The Units for the Integers Mod 9 are: [1, 2, 4, 5, 7, 8]
- The percentage of which is 67%
- The Units for the Integers Mod 10 are: [1, 3, 7, 9]
- The percentage of which is 40%
- The Units for the Integers Mod 11 are: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
- The percentage of which is 91%
- The Units for the Integers Mod 12 are: [1, 5, 7, 11]
- The percentage of which is 33%
- The Units for the Integers Mod 13 are: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
- The percentage of which is 92%
- The Units for the Integers Mod 14 are: [1, 3, 5, 9, 11, 13]
- The percentage of which is 43%
- The Units for the Integers Mod 15 are: [1, 2, 4, 7, 8, 11, 13, 14]
- The percentage of which is 53%
- The Units for the Integers Mod 16 are: [1, 3, 5, 7, 9, 11, 13, 15]
- The percentage of which is 50%
- The Units for the Integers Mod 17 are: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
- The percentage of which is 94%
- The Units for the Integers Mod 18 are: [1, 5, 7, 11, 13, 17]
- The percentage of which is 33%
- The Units for the Integers Mod 19 are: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
- The percentage of which is 95%
- The Units for the Integers Mod 20 are: [1, 3, 7, 9, 11, 13, 17, 19]
- The percentage of which is 40%
- The Units for the Integers Mod 21 are: [1, 2, 4, 5, 8, 10, 11, 13, 16, 17, 19, 20]
- The percentage of which is 57%
- The Units for the Integers Mod 22 are: [1, 3, 5, 7, 9, 13, 15, 17, 19, 21]
- The percentage of which is 45%
- The Units for the Integers Mod 23 are: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
- The percentage of which is 96%
- The Units for the Integers Mod 24 are: [1, 5, 7, 11, 13, 17, 19, 23]
- The percentage of which is 33%
- The Units for the Integers Mod 25 are: [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24]
- The percentage of which is 80%
- The Units for the Integers Mod 26 are: [1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25]
- The percentage of which is 46%
- The Units for the Integers Mod 27 are: [1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25, 26]
- The percentage of which is 67%
- The Units for the Integers Mod 28 are: [1, 3, 5, 9, 11, 13, 15, 17, 19, 23, 25, 27]
- The percentage of which is 43%
- The Units for the Integers Mod 29 are: [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]
- The percentage of which is 97%
- The Units for the Integers Mod 30 are: [1, 7, 11, 13, 17, 19, 23, 29]
- The percentage of which is 27%
- The Units for the Integers Mod 31 are: [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]
- The percentage of which is 97%
- The Units for the Integers Mod 32 are: [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]
- The percentage of which is 50%
- The Units for the Integers Mod 33 are: [1, 2, 4, 5, 7, 8, 10, 13, 14, 16, 17, 19, 20, 23, 25, 26, 28, 29, 31, 32]
- The percentage of which is 61%
- The Units for the Integers Mod 34 are: [1, 3, 5, 7, 9, 11, 13, 15, 19, 21, 23, 25, 27, 29, 31, 33]
- The percentage of which is 47%
- The Units for the Integers Mod 35 are: [1, 2, 3, 4, 6, 8, 9, 11, 12, 13, 16, 17, 18, 19, 22, 23, 24, 26, 27, 29, 31, 32, 33, 34]
- The percentage of which is 69%
- The Units for the Integers Mod 36 are: [1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35]
- The percentage of which is 33%
- The Units for the Integers Mod 37 are: [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]
- The percentage of which is 97%
- The Units for the Integers Mod 38 are: [1, 3, 5, 7, 9, 11, 13, 15, 17, 21, 23, 25, 27, 29, 31, 33, 35, 37]
- The percentage of which is 47%
- The Units for the Integers Mod 39 are: [1, 2, 4, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22, 23, 25, 28, 29, 31, 32, 34, 35, 37, 38]
- The percentage of which is 62%
- The Units for the Integers Mod 40 are: [1, 3, 7, 9, 11, 13, 17, 19, 21, 23, 27, 29, 31, 33, 37, 39]
- The percentage of which is 40%
- The Units for the Integers Mod 41 are: [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]
- The percentage of which is 98%
- The Units for the Integers Mod 42 are: [1, 5, 11, 13, 17, 19, 23, 25, 29, 31, 37, 41]
- The percentage of which is 29%
- The Units for the Integers Mod 43 are: [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]
- The percentage of which is 98%
- The Units for the Integers Mod 44 are: [1, 3, 5, 7, 9, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 35, 37, 39, 41, 43]
- The percentage of which is 45%
- The Units for the Integers Mod 45 are: [1, 2, 4, 7, 8, 11, 13, 14, 16, 17, 19, 22, 23, 26, 28, 29, 31, 32, 34, 37, 38, 41, 43, 44]
- The percentage of which is 53%
- The Units for the Integers Mod 46 are: [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45]
- The percentage of which is 48%
- The Units for the Integers Mod 47 are: [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]
- The percentage of which is 98%
- The Units for the Integers Mod 48 are: [1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47]
- The percentage of which is 33%
- The Units for the Integers Mod 49 are: [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48]
- The percentage of which is 86%
- The Units for the Integers Mod 50 are: [1, 3, 7, 9, 11, 13, 17, 19, 21, 23, 27, 29, 31, 33, 37, 39, 41, 43, 47, 49]
- The percentage of which is 40%
Add Comment
Please, Sign In to add comment