The != means not
equal to.
So the statement:
while((PreviousNumber
!= Number1)  (NextNumber
!= Number2)) is
saying,
if PreviousNumber
is not equal to
Number1 or NextNumber
is not equal to
Number2 continue
with generating
the necklace.
It is a more efficient
statement than:
while(!((PreviousNumber
== Number1) && (NextNumber
== Number2))) because
it can fail if the
first comparision
is false without
having to needlessly
perform the second
comparision....
Its a well known
theorem, In general
(A or B) has the
same value as /(
/A and /B).
That's DeMorgan's
theorem:
¬(A and B) = ¬A
or ¬B
¬(A or B) = ¬A and
¬B
where ¬ = NOT
if my mind serves
me correctly, and
then you can apply
¬¬ to it to get:
¬¬(A and B) = ¬(¬A
or ¬B)
=> (A and B) = ¬(¬A
or ¬B)
similarly for ¬(A
or B) Ian
