1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | language ESSENCE 1.2.0 $ prob041.essence: N-Fractions Puzzle $ Problem details available at http://www.csplib.org/Problems/prob041/ $ 07 September 2007 $ given n : int (1..) letting Index be domain int (1..3*n), Digit be domain int (1..9) find assign : function ( total , surjective ) Index --> Digit such that ( sum i : int (0..n-1) . assign(3*i+1) / (assign(3*i+2)*10 + assign(3*i+3))) = 1, forAll d : Digit . ( sum i : Index . toInt (assign(i) = d)) <= (n+1)/3 |