欧拉项目第28题.
https://projecteuler.net/problem=28
#lang racket ;give a n ;output the outermost diagonal numbers of the n x n spiral form (define (outermost n) (if (= n 1) (list 1) (build-list 4 (λ(x) (+ (* (sub1 n)(add1 x)) (sqr(- n 2))))))) (define (build-diagonal n) (define (iter i r) (if (> i n) r (iter (+ 2 i) (append r (outermost i))))) (iter 1 '())) (display (apply + (build-diagonal 1001)))