Code: Select all
(define (breaknum n)
(if (even? n) nil
(list (* (- n (/ n 2)) (- n (/ n 2))) (* (/ n 2) (/ n 2)) )))
(breaknum 11)
;-> (36 25)
(breaknum 9527)
;-> (22695696 22686169)
1) Pick an odd number (5):
OOOOO
2)Bend it in half:
OOO
O
O
3) Fill the rest:
OOO
OXX
OXX
The odd number is the area difference of the big (9) and small (4) squares.