22a. Feb.G Review

  1. Trace the execution of (snow 300).
(define (snow n)
  (cond [(= 2 (remainder n 3))
		 (quotient n 6)]
		[(< 50 n)
		 (add1 (snow (quotient n 2)))]
		[else
		 (+ 5 (snow (- n 4)))]))
  1. (tall-tree) Make an n layer stack of green triangles and put a brown rectangle at the bottom.

(tall-tree 5)

  1. (cr7 : integer(avoid) -> number) How many multiples of 7 are there from avoid up to 1000? Except do not count any multiple of avoid.

    (Math-only solutions discouraged; practice recursion. Will your solution also work to avoid odd numbers as well as multiples of avoid?)

    Examples:

     (cr7 3) => 95
     (cr7 10) => 127
    
  2. (big-gap? : positive-integer(n) -> boolean) True if n has two adjacent groups of two digits that differ by more than fifty.

    Examples:

     (big-gap? 1030) => false
     (big-gap? 2080) => true
     (big-gap? 123456) => false
     (big-gap? 142958) => true
     (big-gap? 190) => false
    

    Note that in the last example, there are not two adjacent groups of two digits.

Last modified August 18, 2023: 2022-2023 End State (7352e87)