edited by
953 views
0 votes
0 votes
Find a regular expression that denotes all bit strings whose value, when interpreted as a binary integer, is greater than or equal to 40.
edited by

1 Answer

Best answer
1 votes
1 votes

First Let's write RE for all bit strings whose value, when interpreted as a binary integer, is greater than or equal to 64 (Because it will be 7 or more than 7 bits for all these numbers in binary) : $(0+1)^*1(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)^*\,$  

And Now just add strings from 40 to 63 to make RE Complete.


$(0+1)^*1(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)^*\,$ = $0^*1(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)^*\,$ 

selected by

Related questions