NOTICE: This article originally appeared in the September, '88 issue of Michigan Atari Magazine and may be freely distributed or reprinted in non-profit User Group publications as long as the article's author and Michigan Atari Magazine are credited AND this notice is reprinted with the article. All other publications must obtain written permission from Unicorn Publications, 3487 Braeburn Circle, Ann Arbor, MI 48108, Phone: (313) 973-8825 before using this article. Binary Maybe's, And the IF..THEN..Who Cares Maxim. by Clinton Pierce (GAG) In the last installment, I stressed the importance of logical thinking and thinking in general. Now, I hope to give you the tools needed to do this. First of all, walk (do not run and trip over your computer cables) to your bookshelf and pull down an algebra textbook (or calculus, geometry etc..). Theorems and postulates are not just made up at the whim of the publisher. They are derived from logical steps, which themselves are derived. (From What? you say.) Let's make an assumption: the Truth is true. Ok, not bad. (For a proof, see Descartes.) Let's use the equals instead of the word "is." P=P is true. Want some more? P<>_P (P is not, not P), still true. The list of logical operators is extensive and I'm not going to derive each one of them. You should know what each of these does: AND, OR, _(NOT), XOR (Exclusive Or), =, <>, TRUE, FALSE, -> (Implies) and IFF (If and Only If). You should note that there isn't a "looks like" or "should" function. Computers understand is, was, shall be, and nothing else. They don't work well with implications, indecision, morality, and justice. They do what is correct. Let's look at some other things of interest. Numbers. (And for the sake of clarity, integers.) Oh sure, you know all about them. You learned those in the first grade, did you? No. You learned that 5 preceeds 6 and that 2+3 is 5. You didn't learn numbers. Every number greater than 1 is a unique product of primes. [Don't believe me? If N is an integer, then N must be equals to some axb (where a AND b < N) If A or B are nonprime, then they each become their own N and the process starts over.] What good is all of this symbolic garbage? Plenty. Take a simple problem: Find the primes from 1 to 70. Well, we cound take each number and divide it by every number lower than that. That'll only take 2280 repetitions. If we were smart, we would only go up to halfway-1 of each number testing for divisibility (knowing that every number cannot be divided by another evenly, when the second>First/2). We're down to 1061 repetitions. And if we start with 3 (because we KNOW that 2 is prime) and only count odds, we're down to 619. Using Euclid's Lemma, we can only check the odds up to the Square Root of the number to be checked to see if it is prime. We are now down to 135 repetitions. If we stop checking a number as soon as it is nonprime, then we only need 89 repetitions. Knowing all of that symbolic garbage saved us 2191 repetitions. Finding primes was simple, so what? What if you were trying to find a number in a telephone directory of 1,000,000 people? Or trying to sort that list alphabetically? Time and energy used can be saved exponentially. In the next installment, these techniques and others will be used for more "practical" applications.