Division Mod 7 FSM - PowerPoint PPT Presentation

About This Presentation
Title:

Division Mod 7 FSM

Description:

Ends up at the state whose name indicates the remainder when the input number is ... the remainder of the number obtained by appending numeral n at the end of x must ... – PowerPoint PPT presentation

Number of Views:104
Avg rating:3.0/5.0
Slides: 3
Provided by: Lenny55
Category:
Tags: fsm | appending | division | mod

less

Transcript and Presenter's Notes

Title: Division Mod 7 FSM


1
Division Mod 7 FSM
Input is a number (decimal sequence of numerals).
Ends up at the state whose name indicates the
remainder when the input number is divided by 7.
The key intuition is that if a number x has
remainder of r when divided by 7, then the
remainder of the number obtained by appending
numeral n at the end of x must have remainder of
10r n mod 7. For example, 66 has remainder 3
when divided by 7, so 668 should have remainder
30 8 mod 7, or 38 mod 7, or simply 3. (And
indeed, 668 7 x 95 3.) This observation
is true because if x mod 7 r, then x 7q r
for some quotient q. Then the number obtained by
appending the numeral n to the end of x results
in multiplying x by 10, and then adding n, is 10x
n 10(7qr) n 70q 10r n, which has
remainder of 10rn mod 7, since the first term is
divisible by 7. This observation dictates that
from state r (indicating that current remainder
is r), the next state on input n should be to
state 10rn mod 7. (The remainder when 10r n)
is divided by 7. These transitions are drawn
above.
2
Division Mod 7 FSM
0
0
1
6
4
5
5
2
3
1
6
4
2
3
1
6
2
5
3
4
Write a Comment
User Comments (0)
About PowerShow.com