(* Exercice 1 *) (* Question 1 : on doit trouver 1.02530490368186422 *) let th x = failwith "à coder" ;; th 1. ;; (* 0.761594155955764851 *) (* Exercice 2 *) failwith "à coder" (* Exercice 3 *) let rec s n = if n = 0 then 0 else n + s (n-1) ;; let s n = failwith "à coder" ;; (* Exercice 4 *) let rec puiss x n = failwith "à coder" ;; let puiss_term x n = failwith "à coder" ;; puiss_term 2 10 ;; (* 1024 *) let rec expo_rapide x n = failwith "à coder" ;; expo_rapide 2 10 ;; (* 1024 *) (* Exercice 5 *) let rec pgcd u v = failwith "à coder" ;; pgcd 189 231 ;; (* 21 *) (* Exercice 6 *) let rec nb_chiffres b n = failwith "à coder" ;; nb_chiffres 10 999 ;; (* 3 *) nb_chiffres 10 1000 ;; (* 4 *) let rec mystere f n m = if n > m then 1. else f (float_of_int n) *. mystere f (n+1) m ;; let rec fibo n = failwith "à coder" ;; fibo 5 ;; (* 8 *) (* #trace fibo ;; *) fibo 5 ;; (* #untrace fibo ;; *) (* Exercice 9 : Algorithme de Floyd *) let f x = (x*x + 92) mod 32069 ;; (* Q1 *) let rec itere f x0 n = failwith "à coder" ;; (* Q2 *) let rec itereBis f x0 n = failwith "à coder" ;; (* Q3 *) let floyd1 f x0 = failwith "à coder" ;; floyd1 f 33 ;; (* 11326 *) (* Q4 *) let floyd2 f x0 = failwith "à coder" ;; floyd2 f 33 ;; (* 320 *) (* Q6 *) let periode f x0 = failwith "à coder" ;; periode f 33 ;; (* 8 *) (* Q7 *) let prePeriode f x0 = failwith "à coder" ;; prePeriode f 33 ;; (* 313 *) (* Q8 *) let brent f x0 = failwith "à coder" ;; brent f 33 ;; (* 511, 519 *)