Blame


1 12687dd9 2023-08-04 jrmu ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 12687dd9 2023-08-04 jrmu ;; about the language level of this file in a form that our tools can easily process.
3 12687dd9 2023-08-04 jrmu #reader(lib "htdp-intermediate-reader.ss" "lang")((modname |23.2|) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp")))))
4 12687dd9 2023-08-04 jrmu ;a-fives : N[>=0] -> number
5 12687dd9 2023-08-04 jrmu ;Given n, determine recursively the value of the n-th term in the series 8, 13, 18, etc. where the first term has an index 0.
6 12687dd9 2023-08-04 jrmu
7 12687dd9 2023-08-04 jrmu (define (a-fives n)
8 12687dd9 2023-08-04 jrmu (cond
9 12687dd9 2023-08-04 jrmu [(zero? n) 8]
10 12687dd9 2023-08-04 jrmu [else (+ 5 (a-fives (sub1 n)))]))
11 12687dd9 2023-08-04 jrmu
12 12687dd9 2023-08-04 jrmu ;a-fives-closed : N[>=0] -> number