logo elektroda
logo elektroda
X
logo elektroda

How does modulo work? Example: Why is 87 modulo 16 equal to 7?

yeeezooo 68471 8
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 5699902
    yeeezooo
    Level 11  
    I don't know how it counts, for example: 87 modulo 16 = 7 How does it count, someone will tell me? Is it about some padding to 16?
  • ADVERTISEMENT
  • #2 5699921
    Quarz
    Level 43  
    yeeezooo wrote:
    I don't know how it counts, for example: 87 modulo 16 = 7 How does it count, someone will tell me? Is it some padding to 16?
    This is the fraction remainder - the numerator of the fraction - of dividing an integer by an integer; 87/16 = 5 + 7/16, so you drop the whole number and take the numerator of the proper fraction (part less than one) - it must be a rational (non-decimal) fraction.
  • ADVERTISEMENT
  • #3 5700015
    yeeezooo
    Level 11  
    hmm, I don't know if I understood you correctly or if it is that 87/16 = 5.4375
    so we take the integer part which is 5.
    And 5 * 16 is 80, so 87 is missing 7 and hence 87 modulo 16 = 7?
    ok i think
    And secondly, what can it be used for in electronics?
  • ADVERTISEMENT
  • #4 5700058
    Quarz
    Level 43  
    yeeezooo wrote:
    hmm, I don't know if I understood you correctly or if it is that 87/16 = 5.4375
    so we take the integer part which is 5.
    And 5 * 16 is 80, so 87 is missing 7 and hence 87 modulo 16 = 7?
    ok i think
    You can count it anyway.

    yeeezooo wrote:
    And secondly, what can it be used for in electronics?
    And of course it is used in all kinds of digital meters, the capacity of which - the maximum counted quantity - is necessarily finite.
    For example, a binary-binary-one-bit counter counts up to two, a two-bit counter counts up to four, a three-bit counter counts up to eight, a four-bit counter counts up to sixteen, etc.
    And regardless of how many times the full capacity (2 ^ 1, 2 ^ 2, 2 ^ 3, 2 ^ 4, etc.) of such a counter is counted by the counter, the state of the counter that can be read from it is just this rest.
  • #5 5700204
    yeeezooo
    Level 11  
    Quarz wrote:
    This is the fraction remainder - the numerator of the fraction - of dividing an integer by an integer; 87/16 = 5 + 7/16, so you drop the whole number and take the numerator of the proper fraction (part less than one) - it must be a rational (non-decimal) fraction.


    I'm beginning to understand what you wrote but it's hard to find the rational fraction (read quickly) of 0.4375 with the denominator 16, it will be like you wrote 7/16. Therefore, can my method be considered as reliable, because in this example it proved to be successful, but will it always be like this and is it not easier? Do you have a link to the theory of this modulo somewhere?
    By the way, how did you look for this number, i.e. how quickly and by what method did you transform the remainder of 0.4375 to a fraction with a denominator of 16?
  • #6 5700270
    Quarz
    Level 43  
    yeeezooo wrote:
    Quarz wrote:
    This is the fraction remainder - the numerator of the fraction - of dividing an integer by an integer; 87/16 = 5 + 7/16, so you drop the whole number and take the numerator of the proper fraction (part less than one) - it must be a rational (non-decimal) fraction.

    I'm beginning to understand what you wrote, but it's hard to find the rational fraction (read quickly) of 0.4375 with the denominator 16, it will be as you wrote 7/16 .
    This is the rational and proper fraction (less than one).

    yeeezooo wrote:
    Therefore, can my method be considered as reliable, because in this example it has proven to be successful, but will it always be like this and is it not easier? Do you have a link to the theory of this modulo somewhere?
    By the way, how did you look for this number, i.e. how quickly and by what method did you transform the remainder of 0.4375 to a fraction with a denominator of 16?
    Each method is good as it leads - without unnecessary "bends" - to the goal.
    I counted "on foot" ... :idea: :D ... dividing - multiple - by the power of two (16 = 2 ^ 4) is a piece of cake after all ... :!:
    Uncle Google doesn't bite LOOK .
  • #7 5700498
    yeeezooo
    Level 11  
    But something was fucking me when you counted on foot, can you write it down?
    I was looking in google but there are only counters and I am more concerned with math as it counts.
    and for this, for example: 4 mod 5 = 4 and 4 mod n = 4 and here I do not understand it anymore, I still do not see this mathematical apparatus :(



    the moderator deleted my last answer, please do not do it because I am having a discussion with my colleague Quarz and I am a bit out of reasoning, the forum is not only for geniuses and finishing this conversation is for me
    important.



    [Regulations, point 8.2, 16. On the forum we use the Polish font and the adopted spelling rules. The contribution of own work is also required. Mariusz Ch.]
  • ADVERTISEMENT
  • #8 5700927
    Maciek S.
    Level 12  
    For me, modulo is the remainder of dividing two integers. For example, if you have 4 mod 5 here, I understand it like this:

    4/5 => 0 total and 4 remainder

    10 mod 3 = 3 + 1r
    3 mod 2 = 1 + 1r

    r -> remainder of division

    Going back to this 1st example:
    87 mod 16

    87/16 = 5.4375 or .. 5 total and some remainder, which will be the result of 87 mod 16 .. And it will be: 87- (5 * 16) = 7
  • #9 5707015
    yeeezooo
    Level 11  
    thanks to everyone for the help, the topic is closed modulo, it is actually the rest of the division for those who are looking, just like I am adding a sip of the theory.

    Jeżeli a i d są liczbami naturalnymi, gdzie d nie jest zerem, można udowodnić, że istnieją unikalne liczby całkowite q i r, gdzie a = qd + r
    
    i 0 ≤ r < d. Liczba q zwana jest ilorazem, zaś r resztą.
    
    Przykłady 
    
        * Kiedy dzielimy 13 przez 10, 1 jest ilorazem, a 3 jest resztą, gdyż 13 = 1×10 + 3.
        * Kiedy dzielimy 26 przez 4, 6 jest ilorazem, a 2 jest resztą, gdyż 26 = 6×4 + 2.
        * Kiedy dzielimy 56 przez 7, 8 jest ilorazem, a 0 jest resztą, gdyż 56 = 7×8 + 0.
    



    and for the initiated, the interesting thing about integers, then we have two remainders

    jeżeli a i d są liczbami całkowitymi, gdzie d nie jest zerem, wtedy reszta jest liczbą całkowitą taką, że a = qd + r dla pewnego q i przy
    
    0 ≤ |r| < |d|. Kiedy definiujemy w ten sposób istnieją dwie możliwe reszty.
    Na przykład, dzielenie −42 przez −5 może być wyrażone jako
    
        −42 = 9×(−5) + 3
    
    albo
    
        −42 = 8×(−5) + (−2).
    
    Tak więc resztą jest 3 lub −2.
    
    Ta dwuznaczność wartości reszty nie jest niczym zagadkowym. W przypadku powyżej, reszta ujemna jest uzyskiwana poprzez odjęcie 5, które stanowi d. Ta metoda sprawdza się również dla innych liczb całkowitych. Dzieląc przez d, jeśli dodatnią resztą jest r1, a ujemną r2, wtedy
    
        r1=r2+d. 

Topic summary

Modulo refers to the remainder obtained from the division of two integers. For example, in the case of 87 modulo 16, the calculation involves dividing 87 by 16, which results in a quotient of 5 and a remainder of 7. This can be expressed mathematically as 87 = (5 * 16) + 7, leading to the conclusion that 87 mod 16 = 7. The concept of modulo is widely applicable in electronics, particularly in digital counters, where it helps manage finite counting capacities. The modulo operation can be understood through various methods, including direct division and the use of rational fractions. The discussion also touches on the mathematical properties of modulo, emphasizing that for any two natural numbers a and d (where d is not zero), there exist unique integers q (the quotient) and r (the remainder) such that a = qd + r, with 0 ≤ r < d.
Summary generated by the language model.
ADVERTISEMENT