

Taxicab Numbers « Programming Praxis -- Google Interview Question - srsamarthyam
http://programmingpraxis.com/2012/11/09/taxicab-numbers/

======
ankurdhama
A bit of logic programming in core.logic:

(defn cubo [a r] (fresh [a1] ( _fd a a a1) (_ fd a a1 r)))

(defn taxi-cab [n] (run* [q] (fresh [a ac b bc] (infd a b (interval 1 (int
(java.lang.Math/cbrt n)) )) (infd ac bc (interval 0 n)) (cubo a ac) (cubo b
bc) (+fd ac bc n) (== q [a b]))))

NOTE: FYI, could be made more efficient.

