p086.scm 992 B

1234567891011121314151617181920212223242526272829303132
  1. ;; Cuboid route
  2. (define-module (unsolved p086))
  3. ;; a = height, b = length, c = width
  4. (define (find-min-path a b c)
  5. (let ([x (/ (* a b) (+ a c))])
  6. (+ (sqrt (+ (expt a 2) (expt x 2)))
  7. (sqrt (+ (expt c 2) (expt (- b x) 2))))))
  8. ;; Okay i see something interesting with gcd...
  9. ;; All new values that have integer min paths have three numbers that are relatively prime to eachother
  10. ;; Going to work on the common divisors, (totient stuff) and put it in the math module
  11. ;; I haven't been able to figure out the totient stuff, so work on this problem will wait
  12. (define-public (cuboids-with-integer-min-path M)
  13. (let lp ([a 1] [b 1] [c 1] [a-gcd #f] [acc 0])
  14. (cond
  15. [(> a M) acc]
  16. [(> b a) (lp (1+ a) 1 1 acc)]
  17. [(> c b) (lp a (1+ b) 1 acc)]
  18. [else
  19. (lp a b (+ (modulo ))
  20. (if (integer? (min (find-min-path a b c)
  21. (find-min-path c a b)
  22. (find-min-path b c a)))
  23. (begin
  24. (display (list a b c))
  25. (newline)
  26. (1+ acc))
  27. acc))])))