Every odd integer is the difference of 2 squares

Q&A's, tips, howto's

Every odd integer is the difference of 2 squares

Postby cameyo » Thu Sep 05, 2019 1:34 pm

Try this:
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)

Proof
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.
cameyo
 
Posts: 91
Joined: Sun Mar 27, 2011 3:07 pm

Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 1 guest

cron