How often does the letter s occur in:
e.g., how to convert decimal
87
(= letter W, in ASCII)
to 8-bit binary (01010111)
i.e., how to code a decimal numeral with
only 2 objects
Note: An 8-bit binary numeral has these places:
Note: Max
decimal numeral that can be
represented in 8 bits is:
11111111 = 128 + 64 + ... + 2 + 1 = 255
Link to the Algorithm for Converting a Decimal D to an 8-Bit Binary B.
e.g., to convert 87 (decimal)
to 8-bit binary:
So, 87 (decimal) = 01010111
(binary),
reading column 3 from the top down.
e.g., How to convert 8-bit
binary 00101001
to decimal 41? Easy!
Link to the Binary Magic Trick.
c) How to add binary numbers:
Easy!
(Just remember that 1+1 = 10 (= decimal 2))
Multiplication
is similar, even easier!:
In decimal, 2 * 2 = 4
(remember: In computer science * = multiplication)
In binary, 10 * 10 = 100
(which is NOT the same as decimal 10 * 10 = 100 (!) )
- Well return to this later in
the course,
but for more information, see:
Schagrin,
Morton L.; Dipert, Randall R.;
& Rapaport, William J. (1985),
Logic: A Computer Approach
(New York: McGraw-Hill)
in Lockwood Library, BC138 .S32 1985
- Well use Pascal, which is a
much more
expressive language, but no more powerful
- Church-Turing Thesis:
Everything that can be computed
can be computed by a TM
i.e.,
for each computable problem P,
there is a TM that can
compute Ps solution
(n problems, n TMs)
- Turings Theorem:
There is a universal TM that can compute
anything that can be computed.
i.e.,
there is a universal TM, call it U,
such that for each computable problem,
U can compute its solution
(1 TM, n problems)
- Karel the Robot is a TM
(of a special kind)
* sequence (do this; do that)
* selection
(or choice):
if such and such is the case (or is true),
then do this
else do that
* repetition
(or looping):
while such and such is the case (or is true),
do this
(* stop)
(* define
new actions by naming them
(procedures, or subroutines) )
- These are the 3 basic features
of Pascal
(& Karel) that well learn.
user
There are seventy-three "s"s.
assistant