!" # $% &' ) ( * $" ) + , ( ( - $ $ #( 0 1 / ( $ ( . / '0 ( ( . - 0 ( /( ( ( - $ ( 2 ( . 2& '0 3 )( ( 36 36 : 36 36 36 36 : (4- 4 4 5/& 4 / 4 4 55 5 4 / 4 4:55 5 4 4 4 4 / 4 4 4 5/35. 47895 478 5 4 4:55 5 478;<5 5/ 4 55 4+8+5 5/ 4 4 55 5 4+895 5/ 4 4:55 5 4+8=5 ) 1 6 +. 9. > & $ & ( !" 4 ( 5> ( - / 54 ( ) 4 5 48? +. /3 ( 5 1 ( ? 6 - 4? / ? 5$ 3 ( 6- 43 / 35 " ( 2 # ? 4 0 5 ( & ( @ 4 9. # / 5:4 ? / A ;;A 5/4 ( & $? 4? / 5:4? /? 5 4 5/ 5:4 4 5/ A ;;A 5: ( ) * & ( 4 / 4 55 → B ( 4 4 5/ 5→3 ( 4C/ 4 55 → C6 C6 3 ( 4 5D 4C/ C6 3 ) D 4 D 55 → 1 4 5 +2 • generar(float(He, Hd), float(Ne, Nd)) :menor(Ne,He), noventaYNueve(N), moi(Nd, N). 92 • generar(float(He, Hd), float(He, Nd)) :moi(Nd,Hd). " " 483 ( 5. " ( - 43 / 35 $ 3 83 ( , ( 48C/ 8B/E5 ( 48C5 ( & ) * ( 4C52 4#/ C5. 4 5/C/ 4C/C/ 4 55. 4#/C/ 4355 2( 4#/C/35 4#/ C55. 4 4 4#/ 35 2( 43/#/ 2( 4 4 555. 4#/ C5/ 4#/ C5/ 4 4 5. ! ( 4C/#/C5 2( 4C/ #5. ( 4C/#/ 5 2 4( 4C/ #55/ ( 4#// C5/( 4 / #/5. (4 (4 /B/B5. 4C5/B/ 4?55 2 ( 4C/ B/ ?5. 4#5/ C/ 35/ 4#5/ C/ 35/ 1 4" 5 • test(float(Ne, Nd)) :- suma(Ne, Nd, S), primo(S). ) 9 1 F /$ 2 /& "# /& "# "# #"# $ % & '0 ( "# . $ % / $ ( '0 "# '0 . . )( F 6 4 /+5/ 4 / 9G5/ 4 / 9G5/ 4/ 9=5/ 4 / 9H5/ 4 & / 5. 4 / +I5 ) 1 6 !" +. 9. > & & ( ( *( ) ) 4 48F 5 / 5 J 2 4 # 5 & $ $$ & ' ) "# "# 1 4 5 • Generar(Ag, Conjunto) :personas(Ag, Personas), partes(Personas, Xs), member(Conjunto, Xs). $ $$ 4K L /K K L L 5. 4K CMCL /E5 2 # # "( F" F" 4C/N 5/ F" 4C/N /B5/ 4N /B/E5. $$) $$* 4O/ K L / K L 5. 4C/K BMBL /K K CM BLMEL 52 F" 4C/B/E5. " " 48F " ( ( ( ( /8) F /8 / $ ) ( ( 5. $ ) (' ) ( & >& ) & ( F & ( * ( 1 Test(Agenda,Edad, Conjunto) :sumaEdad(Agenda, Conjunto, Suma), length(Conjunto, N), N>0, Edad > (Suma / N). sumaEdad(+Agenda, +Conjunto, -Sedad) sumaEdad(_, [], 0). sumaEdad(Ag, [X|Xs], N) :sumaEdad(Ag, Xs, N1), edad(Ag, X, E), N is N1 + E.