Monday, November 2, 2009

interesting...

after playing around with the sequence(n) function from ch. 6,
I found that sequence(5/9) creates an infinite loop of zeros. I just thought that was interesting...

2 comments:

  1. Both 5 an 9 are ints, so 5/9 is 0. Since 0 % 2 is 0, and 0 will not be equal to 1 forever, you have an infinite loop.

    I think I'm going to add a sentence to chapter 6 that says n should be an int >= 1.

    ReplyDelete
  2. btw. I've changed this section of chapter 6 in response to your posting here so that it now states that n is a positive integer.

    ReplyDelete