Commit 1c599a63 by Jean-Christophe Filliâtre

renamed example euler290 -> sum_of_digits

parent ed79c65a
 (* How many integers 0 <= n < 10^18 have the property that the sum of the digits of n equals the sum of digits of 137n? (** Projet Euler problem #290 The answer is 20444710234716473. How many integers 0 <= n < 10^18 have the property that the sum of the digits of n equals the sum of digits of 137n? It can be easily computer using memoization (or, equivalently, dynamic It can be easily computed using memoization (or, equivalently, dynamic programming) once the problem is generalized as follows: How many integers 0 <= n < 10^m are such that sd(n) = sd(137n + a) + b? ... ... @@ -38,7 +39,7 @@ module Euler290 function solution(a b m: int) : int = P.num_of (a,b,10) 0 (power 10 m) (* short cut for the number of n st n mod 10 = c and ... *) (* shortcut for the number of n st n mod 10 = c and ... *) function num_of_modc (d: int3) (x y: int) : int = let (a,b,c) = d in ... ... @@ -51,7 +52,7 @@ module Euler290 lemma Empty: forall a b x y: int. P.num_of (a,b,0) x y = 0 lemma Induc: forall a b c: int,m:int. 0 <= a -> 0 <= c < 10 -> m > 0 -> let x = 137 * c + a in ... ...
 ... ... @@ -18,18 +18,18 @@ name="CVC4" version="1.3"/>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!