- Commit
- 43c66e512f41679884e4e954d5bcaac53fae412c
- Parent
- 51eb1896776f48751b3ef8d5428b1e83eb684b11
- Author
- Gark Garcia <37553739+GarkGarcia@users.noreply.github.com>
- Date
Updated README.md
An exercise on polyglossy: the same problem solved on multiple languages
Updated README.md
1 file changed, 12 insertions, 5 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | README.md | 17 | 12 | 5 |
diff --git a/README.md b/README.md @@ -1,17 +1,24 @@ # A Conjecture of Mine An exercise on _polyglossy_. The same problem solved on multiple languages. -## Problem -Let <img src="https://latex.codecogs.com/gif.latex?S:\mathbb{N}&space;\mapsto&space;\mathbb{N}"/> be the sum of the digits of a positive integer. +## The Problem - Mathematicians Version +Let <img src="https://latex.codecogs.com/svg.latex?S:&space;\mathbb{N}\rightarrow&space;\mathbb{N}"/> be the sum of the digits of a positive integer in a [_base 10 positional number system_](https://en.wikipedia.org/wiki/Positional_notation). We have: -Prove that <img src="https://latex.codecogs.com/gif.latex?\forall&space;a,&space;b&space;\in\mathbb{N}&space;:&space;S_{a&space;+&space;b}&space;=&space;S_a&space;+&space;S_b&space;+&space;9&space;k,&space;k&space;\in&space;\mathbb{Z}"/>. +<img src="https://latex.codecogs.com/svg.latex?\forall&space;a,&space;b&space;\in&space;\mathbb{N},&space;S_{a&space;+&space;b}&space;\equiv&space;S_a&space;+&space;S_b&space;\;\(\textup{mod}\;&space;9&space;\)"/> + +### Addendum +This conjecture can be generalized for any _positional number system_. Check out `proof.pdf` for more information. + +## The Problem - Programmers Verison + +Let `S(n: uint) -> uint` be the sum of the digits of `n` in [_base 10_](https://en.wikipedia.org/wiki/Decimal). Then, for all `a` and `b` of type `uint`, `S(a + b) - ( S(a) + S(b) ) % 9 == 0`. ## Performance -The conjecture was [proved by exhaustion](https://en.wikipedia.org/wiki/Proof_by_exhaustion) for the interval <img src="https://latex.codecogs.com/gif.latex?[0;10^4]"/> in multiple language implementations. The performance of each language was then avaliated as the following: +The conjecture was [proved by exhaustion](https://en.wikipedia.org/wiki/Proof_by_exhaustion) for the interval <img src="https://latex.codecogs.com/svg.latex?[0,&space;10^4]"/> in multiple language implementations. The performance of each language was then avaliated as the following: |Language |Milliseconds| |--------------|------------| -|**Rust** |115 | +|**Rust** |103 | |**Kotlin** |137 | |**Go** |155 | |**C** |271 |